Skip to content

Instantly share code, notes, and snippets.

@filipeandre
Last active May 8, 2018 16:25
Show Gist options
  • Save filipeandre/a0b5851e2864b0c98bdf699785a0be0e to your computer and use it in GitHub Desktop.
Save filipeandre/a0b5851e2864b0c98bdf699785a0be0e to your computer and use it in GitHub Desktop.
Docker commands
# Copy files from host to container and vice versa
docker cp src/. $container:/target
docker cp $container:/src/. target
# Exec an command on a running container
docker exec -it $container $command
# List all containers running or not
docker ps -a
# Container start, stop and restart
docker start $container
docker stop $container
docker restart $container
# Docker compose up deamon and simple
docker-compose up -d
docker-compose up
docker-compose down
# Check the config of a container or network
docker inspect $container
docker network inspect $network
# List all images
docker images
# Attach to a running container without leaving on ctrl-c
docker attach --sig-proxy=false $container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment