Skip to content

Instantly share code, notes, and snippets.

@sancau
Last active July 27, 2016 17:33
Show Gist options
  • Save sancau/c987a8196f036de5619a0d6b6fc191ad to your computer and use it in GitHub Desktop.
Save sancau/c987a8196f036de5619a0d6b6fc191ad to your computer and use it in GitHub Desktop.

some usefull docker stuff

One liner to stop / remove all of Docker containers:

docker stop $(docker ps -a -q)

docker rm $(docker ps -a -q)

move files from host to container and overwise

docker cp foo.txt mycontainer:/foo.txt

docker cp mycontainer:/foo.txt foo.txt

access bash in container

docker exec -it mycontainername bash

#restore mongo db

mongorestore --drop -d database-name directory-of-dumped-backup

containers linking

Link mongo with node like this: docker run --link=myMongoDB:mongodb -it node

https://www.thachmai.info/2015/05/10/docker-container-linking-mongo-node/

http://www.ifdattic.com/how-to-mongodb-nodejs-docker/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment