docker pull [image-name]
- pull image onto machine
docker images
- list images on your machine
docker rmi [imageID]
- remove image from machine
docker run [image-name]
- run an image, DLs it if not on machine
docker run -p 8080:80 [image-name]
- run an image and bind port from docker (8080 here) to container (80)
docker inspect [container-name]
- gives you information about where the container is mounted and where volume files are written
docker ps -a
- view all containers on your machine (regardless of running)
docker rm [containerID]
- remove container from machine
docker run -p 8080:80 -v var/www [image-name]
- run image, bind port, set writable volume at "var/www" that docker host writes peristent files to. Docker will automatically choose where this "var/www" is written as a managed volume
docker rm -v [container-name]
- removes the container along w/ the managed volume by docker. If you do the command below in which you specificy the volume yourself,
-v
will not affect it onrm
command
docker run -p 8080:80 -v $(pwd):/var/www [image-name]
- run image, bind port, set writable volume at "var/www" that docker host writes peristent files to in the current working directory (wherever the command was ran)
docker pull mcr.microsoft.com/dotnet/sdk
- pull latest Dotnet SDK image
docker run -it -p 8080:5000 -v ${PWD}:/app -w "/app" mcr.microsoft.com/dotnet/core/sdk /bin/bash
- run inside an MVC project, will open a bash shell to that folder on your LOCAL machine from within the container (Docker has made this a volume visible to the container)
^ Demonstrates a nice feature in docker, source code can be local, but ran inside a container so you can run your app w/ your needed frameworks on an OS just using docker (no need to install them locally)
docker login
docker push <username>/<image_name>
- pushes your image to a public docker hub repo (upload might take a while)