[英]Running docker-compose up, stuck on a "infinite" "creating...[container/image]" php and mysql images
I'm new to Docker, so i don't know if it's a programming mistake or something, one thing i found strange is that in a Mac it worked fine, but running on windows, doesn't.我是 Docker 新手,所以我不知道这是编程错误还是什么,我觉得奇怪的一件事是,在 Mac 上它运行良好,但在 Windows 上运行却不行。
docker-compose.yml码头工人-compose.yml
version: '2.1'
services:
db:
build: ./backend
restart: always
ports:
- "3306:3306"
volumes:
- /var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=123
- MYSQL_DATABASE=demo
- MYSQL_USER=user
- MYSQL_PASSWORD=123
php:
build: ./frontend
ports:
- "80:80"
volumes:
- ./frontend:/var/www/html
links:
- db
Docker file inside ./frontend ./frontend 中的 Docker 文件
FROM php:7.2-apache
# Enable mysqli to connect to database
RUN docker-php-ext-install mysqli
# Document root
WORKDIR /var/www/html
COPY . /var/www/html/
Dockerfile inside ./backend ./backend 里面的 Dockerfile
FROM mysql:5.7
COPY ./demo.sql /docker-entrypoint-initdb.d
Console:安慰:
$ docker-compose up
Creating phpsampleapp_db_1 ... done
Creating phpsampleapp_db_1 ...
Creating phpsampleapp_php_1 ...
It stays forever like that, i tried a bunch of things.它永远保持这样,我尝试了很多东西。 I'm using Docker version 17.12.0-ce.
我正在使用 Docker 版本 17.12.0-ce。 And enabled Linux container mode.
并启用了 Linux 容器模式。
I think i don't need the "version" and "services", but anyway.我想我不需要“版本”和“服务”,但无论如何。 Thanks.
谢谢。
In my case, the fix was simply to restart Docker Desktop.就我而言,修复只是重新启动 Docker Desktop。 After that all went smoothly
之后一切顺利
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.