Docker

Docker cheat sheet

  • Stop all containers - docker stop $(docker ps -a -q)
  • Debug into running container - docker exec -it container_name /bin/bash
  • Debug into docker image - docker run --rm -it image_name /bin/bash
  • Remove all docker dontainers - docker rm -f $(docker ps -a -q)
  • remove all images you need to download everything again) - docker rmi -f $(docker images -q)
  • delete all docker network bridges - docker network prune

Pushing container to Docker hub

First build an docker container and run it afterwards so you see it with docker ps -a As an example, I use the container for the MagpiDownloader

docker build -f Dockerfile . -t mag-pi-downloader
docker run -v $(pwd)/issues:/app/issues/ mag-pi-downloader -f 131

After that is done, have a look, for all the docker container:

$ docker ps -a
CONTAINER ID   IMAGE               COMMAND                  CREATED              STATUS                          PORTS     NAMES
ea901f38e328   mag-pi-downloader   "/bin/sh /app/entryp…"   About a minute ago   Exited (0) About a minute ago             exciting_feistel

As you can see the newest has the container id ea901f38e328