2.2.2 Debugging

View in the book. Buy the book.

Some commands to debug Docker

List processes

$ docker ps
CONTAINER ID   IMAGE        COMMAND                  CREATED          STATUS          PORTS                  NAMES
e3ce2ae9f6fe   timeserver   "/bin/sh -c 'python3…"   34 seconds ago   Up 33 seconds   0.0.0.0:8080->80/tcp   hopeful_turing
$ ls=6989d3097d6b
$ docker exec -it $CONTAINER_ID sh
# ls
Dockerfile server.py
# exit
$

Copy a file to the container

docker cp server.py $CONTAINER_ID:/app

Copy a file from the container

docker cp $CONTAINER_ID:/app/server.py .