docker阿里镜像 常用的docker命令
程序员文章站
2024-03-12 19:58:26
...
安装docker
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/intranet | sh -
使用国内镜像(红色部分使用自己的hub服务)
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=<your accelerate address>\"" | sudo tee -a /etc/default/docker
sudo service docker restart
安装docker-composer
sudo curl -L https://github.com/docker/compose/releases/download/1.15.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
常用
sudo docker run -e MYSQL_ROOT_PASSWORD= -p 16001:3306 -v $PWD:/var/lib/mysql --name pool.db.cn -d mysql
sudo docker run --name pay.redis -p 26379:6379 -d redis
composer 命令
sudo CRON=1 PORT=14000 MASTER=1 docker-compose up --build -d
docker-composer.yml
version: '2'
services:
web:
environment:
- CRON
- ENV
- MASTER
build: './install/docker'
ports:
- "${PORT}:80"
volumes:
- ./src:/work/site
hostname: ${CONTAINER_NAME}
cap_add:
- SYS_PTRACE%