docker-composer使用

1.安装

第一步
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
第二步
chmod +x /usr/local/bin/docker-compose
第三步
docker-compose --version

2.基本命令

docker-compose up //启动yml文件定义的container
docker-compose up -d //后台运行
docker-compose up --help //查看up帮助
docker-compose -f docker-compose.yml up //-f 指定yml文件
docker-compose stop //停止
docker-compose start 
docker-compose ls  //查看
docker-compose down //停止删除
docker-compose ps
docker-compose images
docker-compose exec {service_name} {bash}

如果报错:

ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I DOCKER -i br-729c0f253400 -j RETURN: iptables: No chain/target/match by that name.
(exit status 1))

请重启docker,因为可能之前端口被占用了

你可能感兴趣的:(docker)