运行命令

启动一个容器

1
2
3
4
#Will enter the log console
docker-compose up ${image_name}
#When you add '-d' , run without enter the log console
docker-compose up -d ${image_name}

错误

ERROR: Named volume “mqdata:/var/lib/rabbitmq:rw” is used in service “rabbitmq” but no declaration was found in the volumes section.

原因: docker compose 的版本太低了

解决方法:

升级 docker compose 版本 从 1.24.1 升级到 2.x

sudo curl -L “https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose