# Docker Cheatsheet ## Get a shell on a container `docker exec -it containerName bash` ## Make a docker container start automatically in case of restart. If not started: `docker run -d --restart unless-stopped containerName` If already started: `docker update --restart unless-stopped containerName` Update all running containers: `docker update --restart unless-stopped $(docker ps -a)` ## Get a shell on a container ``` docker exec -it mycontainer bash ``` ## Copy files to and from container ``` docker cp foo.txt mycontainer:/foo.txt docker cp mycontainer:foo.txt foo.txt ```