-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Commands
clydeu edited this page Jun 17, 2019
·
5 revisions
docker build -t <name>:<tag> .
Pre-requisite:
- Make sure host drive is shared by going to docker settings -> Shared drives
docker container run -d -it --name <container name> -p <host port>:<container port> --mount type=bind,source="<host directory>",target=<target directory> <image name>
When using Windows, make sure host directory path has forward slash instead of back slash. e.g. D:/path/to/mount/directory
docker container run -d -it --name <container name> -p <host port>:<container port> <image name>
Use -P flag to automatically map the ports
docker exec -i -t <container name/id> /bin/bash
docker run -it <image name> sh
For images with an entry point:
docker run -it --entrypoint sh <image name>
docker image history --no-trunc <image name> > image_history