我已经通过docker-compose创建了一个具有多个容器服务的网站,并且在我的本地计算机上运行良好。我已经保存了所有本地图像,并将它们作为描述者here加载到服务器中。现在我在本地有一个docker-compose.yaml文件,其中包含所有配置,例如端口,其中指定的链接。如何在服务器上运行相同的配置?
我的配置文件是
version: '2'
volumes:
dbdata:
driver: local
services:
webserver:
container_name: "webserver"
image: "sb/webserver:prod"
restart: always
ports:
- 80:80
build:
context: ./sb-web
dockerfile: Dockerfile
app:
container_name: "app"
image: "sb/app:prod"
restart: always
build:
context: ./sb-app
dockerfile: Dockerfile.prod
working_dir: /usr/src/app
depends_on:
- webserver
api:
container_name: "api"
image: "sb/api:prod"
build:
context: ./sb-api
dockerfile: Dockerfile
restart: always
links:
- database
working_dir: /var/www/html
depends_on:
- webserver
database:
container_name: "database"
image: "sb/database:prod"
build:
context: ./sb-db
dockerfile: Dockerfile
restart: always
environment:
MYSQL_ROOT_PASSWORD: pass
volumes:
- dbdata:/var/lib/mysql