Open tiancheng91 opened 5 years ago
docker build -t friendlyhello . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyhello # Run "friendlyhello" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyhello # Same thing, but in detached mode
docker container ls # List all running containers
docker container ls -a # List all containers, even those not running
docker container stop
docker stack ls # List stacks or apps
docker stack deploy -c
docker-compose -f docker-compose.yml -f docker-compose.prd.yml --env-file ./config/.env.prd up
webapp:
build: .
ports:
- "8000:8000"
volumes:
- "/data"
web:
extends:
file: common-services.yml
service: webapp
docker service create \
--mode global \
--replicas 10 \
--replicas-max-per-node 1 \
--name redis \
--update-delay 10s \
--update-parallelism 2 \
--publish published=8080,target=80
--name hosttempl --hostname="{{.Node.Hostname}}-{{.Node.ID}}-{{.Service.Name}}"\
redis:3.0.6
--cpus=0.2 // cpu个数(时间片) --cpuset-cpus="1,2,3" // 绑定到核心上 --cpu-shares=512 // 争用时资源比例
FROM arm64v8/alpine:3.9
RUN echo https://mirrors.cloud.tencent.com/alpine/v3.9/main > /etc/apk/repositories; \ echo https://mirrors.cloud.tencent.com/alpine/v3.9/community >> /etc/apk/repositories
RUN apk --no-cache add py3-lxml py3-curl py3-crypto py3-certifi py3-gevent py3-greenlet py3-mongo py3-redis py3-tornado py3-requests py3-six