我使用docker compose为Laravel应用程序构建PHP8/Nginx。我用docker compse-up成功地启动了它。
docker ps
提供以下输出:
CONTAINER ID IMAGE COMMAND NAMES
b0e55ad98a63 laravel-app "docker-php-entrypoi..." laravel_docker_medium_tut_app_1
da779e8fa633 nginx:alpine "/docker-entrypoint...." laravel_docker_medium_tut_nginx_1
我存放docker-compose.yml的文件夹名为:
.
我可以使用以下命令重命名容器:
docker rename b0e55ad98a63 laravel-api-app
docker rename da779e8fa633 laravel-api-nginx
CONTAINER ID IMAGE COMMAND NAMES
b0e55ad98a63 laravel-app "docker-php-entrypoi..." laravel-api-app
da779e8fa633 nginx:alpine "/docker-entrypoint...." laravel-api-nginx
问题:
docker-compose down
然后
docker-compose up -d
我又有了老名字:laravel_docker_medium_tut_app_1,laravel_docker_medium_tut_nginx_1。
我的问题:
这是我的
:
version: "3.7"
services:
#Laravel App
app:
build:
args:
user: mike
uid: 1000
context: ./
dockerfile: Dockerfile
image: laravel-app
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www
networks:
- mynetwork
#Nginx Service
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- 8000:80
volumes:
- ./:/var/www
- ./nginx/conf.d:/etc/nginx/conf.d/
networks:
- mynetwork
#Mysl Service
networks:
mynetwork:
driver: bridge