# List docker containers running docker ps docker container ls # same # Attach to a working container (Name555 is NAME) docker exec -it Name555 bash # Create a docker image docker build -t Tag123:v2 . # Uses local Dockerfile docker build -f Dockerfile22 -t Tag123:v2 . # Start the image as container docker run Tag123:v2 --name ContName4 docker run -it -v /host/dir:/docker/dir2 Tag123:v4 /bin/sh docker run -it -v /host/dir:/docker/dir2:ro Tag446:v7 /bin/sh # Read-only mapping # Read last 50 lines and follow logs docker logs -f -n 50 ContName4 # Read and follow logs, dump into a file docker logs -f -n50 ContName4 2>&1 | tee ContName4.log # See running containers docker ps docker ps -a # Show all and dead ones # Copy from docker docker cp ContName:/dir1/dir2 ~/src/ docker cp /src/scripts ContName:/dir1/dir2/ # Export FS docker export -o postmortem.tar Name555 # See container spec docker inspect ContName4 docker inspect 590ba28c2ec3 | grep LogPath # Download the image from the storage docker image pull python:3.11-slim-bookworm