-
Notifications
You must be signed in to change notification settings - Fork 394
Accessing the running Mongodb docker container from command line on EC2
Login from command line with your SSH intructions. You can get these from the AWS console, simply click on your instance on the EC2 dashboard. Instructions will look something like this.
ssh -i "fd.pem" [email protected] Run this from your directory where your pem file resides.
Once logged into EC2 you will get to your ubuntu command prompt. Run docker ps to get the container ID.
ubuntu@ip-172-31-22-48:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 562daf0ad426 meteorhacks/meteord:base "/bin/sh -c 'bash $ME" 11 days ago Up 11 days 0.0.0.0:80->80/tcp orderguide 7185c64943b0 mongo "/entrypoint.sh mongo" 11 days ago Up 11 days 127.0.0.1:27017->27017/tcp mongodb
next run a docker container for bash to connect to mongo using your container id. ubuntu@ip-172-31-22-48:~$ docker exec -it 7185c64943b0 bash then type mongo to access mongo client.
You should now be able to access your db from shell. access mongo docker containers this blog is a good reference for accessing mongo docker containers.