Skip to content

Instantly share code, notes, and snippets.

@Haelle
Last active January 24, 2021 16:39
Show Gist options
  • Save Haelle/6045db870a67403524356de3312ba213 to your computer and use it in GitHub Desktop.
Save Haelle/6045db870a67403524356de3312ba213 to your computer and use it in GitHub Desktop.
Docker

Commands:

  • docker ps : list running containers (option -a exited ones)

  • docker run <image name> : run/install docker image ; options :

    • it : interactive
    • --rm : delete container after it stops
    • --mount type=bind,source=$(pwd),destination=/src : mount current dir to /src on the container
  • docker rm <id|name> : delete container

  • docker diff <id|name> : show diff made in this image

  • docker system df: show space taken by docker

  • docker system prune: clean up some unused space

  • docker exec -it <container-id|name> <command> : execute une commande dans le container (sh par exemple)

  • docker build -t <build_name>:<tag_name> . : build the current directory image against its Dockerfile with build_name

  • docker start/stop <container-id|name> : start/stop container by name/id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment