Skip to content

Instantly share code, notes, and snippets.

@scottjbarr
Last active August 31, 2017 01:19
Show Gist options
  • Select an option

  • Save scottjbarr/27ab904b5fba66ee8b8fc43c7db12a74 to your computer and use it in GitHub Desktop.

Select an option

Save scottjbarr/27ab904b5fba66ee8b8fc43c7db12a74 to your computer and use it in GitHub Desktop.
Docker Cheatsheet

Docker Cheatsheet

Reminders for running docker

Start container in background, exposing port and enabling shell

docker run -d -p 127.0.0.1:9000:80 -it debian /bin/bash

Connect to running container

docker attach container-id

Open Shell On Running Container

docker exec -i -t container-id  /bin/bash

Remove all containers, including previously stopped ones

docker ps -a | ^Ct -f 1 -d\  | xargs docker rm

Copy a file to a container

Copying to a container.

docker cp foo.txt mycontainer:/foo.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment