Skip to content

Instantly share code, notes, and snippets.

@danijeljw
Forked from dwilkie/docker-cheat-sheat.md
Last active March 18, 2023 21:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danijeljw/a7a2553bd06742648172363ce3983a9a to your computer and use it in GitHub Desktop.
Save danijeljw/a7a2553bd06742648172363ce3983a9a to your computer and use it in GitHub Desktop.
Windows Docker Cheat Sheet

Build docker image

PS> cd \path\to\Dockerfile
PS> docker build .

View running processes

PS> docker ps

View all processes

PS> docker ps -a

Run an image in a new container daemonized

PS> docker run -d <image_name>

Run an image in interactive mode with the command powershell.exe

PS> docker run -i -t <image_name> powershell.exe

Run an image in interactive mode with the command powershell.exe and link the ports.

PS> docker run -i -t --link <docker_container_name>:<docker_container_alias> <image_name> powershell.exe

Run an image with an ENTRYPOINT command in interactive mode with the command powershell.exe

PS> docker run --entrypoint powershell.exe -i -t <image_name>

Run an image in interactive mode with the command powershell.exe mounting the host directory /var/app/current to the container directory /usr/src/app

PS> docker run -i -t -v /var/app/current:/usr/src/app/ <image_name> powershell.exe

Run an image in interactive mode with the command powershell.exe setting the environments variables FOO and BAR

PS> docker run -i -t -e FOO=foo -e BAR=bar <image_name> powershell.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment