docker pull <imagename>
docker images
- -d = run in background (daemon)
- -p = map our PC's port 7200 to Docker 3000 port
- --name = image name
docker run -d -p 7200:3000 --name=helloworld <imagename>
docker ps
docker ps -a
docker start helloworld
docker stop helloworld
docker rm helloworld
- when you have some codes that don't want to upload to docker registry.
- Suffix your command with
-v <full path>
.
- Incase you have to type a long command like
docker run -d -p 7200:3000 -v /Users/xxxxx/Documents/ddddd/workingfolder:/hello trust/helloworld
- You can replace that command with an
.yml
file. docker-compose.yml
version: '3.1'
services:
helloworld:
image: trust/helloworld
ports:
- 7200:3000
container_name: helloworld
volumes:
- /Users/xxxxx/Documents/ddddd/workingfolder:/hello
- and run with
docker-compose up -d
within the directory that.yml
exists.