这是我的基本docker-compse.yml。每次我输入“ docker-compose up -d”时,我都会从终端上“完成”。但是在浏览器中,我收到404错误消息。任何想法,我想念什么?
mariadb:
image: wodby/mariadb:$MARIADB_TAG
container_name: "${PROJECT_NAME}_mariadb"
stop_grace_period: 30s
environment:
MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
MYSQL_DATABASE: $DB_NAME
MYSQL_USER: $DB_USER
MYSQL_PASSWORD: $DB_PASSWORD
数据库代码
php:
image: wodby/wordpress-php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
DB_HOST: $DB_HOST
DB_USER: $DB_USER
DB_PASSWORD: $DB_PASSWORD
DB_NAME: $DB_NAME
volumes:
- ${CODEBASE}:${CODEBASE}
php代码
nginx:
image: wodby/wordpress-nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
depends_on:
- php
environment:
NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
NGINX_SERVER_NAME: ${PROJECT_BASE_URL}
NGINX_SERVER_ROOT: ${CODEBASE}/web
volumes:
- ${CODEBASE}:${CODEBASE}
labels:
- 'traefik.backend=nginx'
- 'traefik.port=80'
- 'traefik.frontend.rule=Host:${PROJECT_BASE_URL}'
mailhog:
image: mailhog/mailhog
container_name: "${PROJECT_NAME}_mailhog"
labels:
- 'traefik.backend=mailhog'
- 'traefik.port=8025'
- 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}'
varnish:
image: wodby/wordpress-varnish:$VARNISH_TAG
container_name: "${PROJECT_NAME}_varnish"
depends_on:
- nginx
environment:
VARNISH_SECRET: ${VARN_SECRET}
VARNISH_BACKEND_HOST: nginx
VARNISH_BACKEND_PORT: 80
VARNISH_PURGE_KEY: ${VARN_PURGE_KEY}
labels:
- 'traefik.backend=varnish'
- 'traefik.port=6081'
- 'traefik.frontend.rule=Host:varnish.${PROJECT_BASE_URL}'
redis:
image: wodby/redis:$REDIS_TAG
container_name: "${PROJECT_NAME}_redis"
depends_on:
- varnish
adminer:
image: adminer
container_name: "${PROJECT_NAME}_adminer"
command: php -S 0.0.0.0:9000 -t /var/www/html
environment:
ADMINER_SALT: adminer-salt
ADMINER_DESIGN: pappu687
labels:
- 'traefik.backend=adminer'
- 'traefik.port=9000'
- 'traefik.frontend.rule=Host:adminer.${PROJECT_BASE_URL}'
nginx代码
portainer:
image: portainer/portainer
container_name: "${PROJECT_NAME}_portainer"
command: --no-auth -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- 'traefik.backend=portainer'
- 'traefik.port=9000'
- 'traefik.frontend.rule=Host:portainer.${PROJECT_BASE_URL}'
traefik:
image: traefik
container_name: "${PROJECT_NAME}_traefik"
command: -c /dev/null --web --docker --logLevel=INFO
ports:
也许我在portainer中需要更多代码
- '80:80'
- '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
端口“ serverip:80”的代码
sudo snap install postman
有一个.env文件,其中包含所有密码和链接