JBay Solutions Development Blog on Java, Android, Play2 and others
RSS RSS RSS RSS

Docker CheatSheet

Compilation of some of the most useful commands that I usually need for docker, that I keep on having to search google for.

  1. List of Containers Running
  2. List All Containers
  3. Open Bash on a Container
  4. Copy files to Container
  5. Copy files from Container
  6. View Logs of Container

List of Containers Running

docker ps
$ sudo docker ps
CONTAINER ID  IMAGE            COMMAND    CREATED STATUS  PORTS          NAMES  
a65b4a162136  webserver:latest /bin/bash  ...     ...     22/tcp, 80/tcp webserver  

List all Containers

docker ps -a

Open Bash on a Container

sudo docker exec -i -t a65b4a162136 /bin/bash

or

sudo docker exec -i -t webserver /bin/bash

Copy files to Container

docker cp application.war webserver:/root/application.war

Copy files from Container

docker cp webserver:/root/application.war application.war

View Logs of Container

docker logs a65b4a162136


comments powered by Disqus