- 以下是docker-compose.yml文件内容:
version: '3' services: app: image: 192.168.3.16:5000/docker-study:latest hostname: app container_name: v-app restart: always ports: - "8880:8080" # expose: # - "8080" command: java -jar /app.jar --server.port=8080 web: image: 192.168.3.16:5000/docker-study:latest hostname: web container_name: v-web restart: always ports: - "8881:8081" depends_on: - app # expose: # - "8081" command: java -jar /app.jar --server.port=8081
2. 启动服务:
docker-compose up -d
停止服务:
docker-compose stop
关闭服务:
docker-compose down
查看项目中目前所有容器:
docker-compose ps