为什么我不能使用 Laradock 访问本地主机?
Why can't I go to localhost using Laradock?
我收到错误消息:此页面无法正常工作
我 运行 在 Laradock 目录中执行以下命令,但当我转到本地主机时它没有连接。 docker-compose up -d nginx postgres
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
19433b191832 laradock_nginx "/bin/bash /opt/star…" 5 minutes ago Up 5 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp laradock_nginx_1
e7f68a9d841d laradock_php-fpm "docker-php-entrypoi…" 5 minutes ago Up 5 minutes 9000/tcp laradock_php-fpm_1
3c73fedff4aa laradock_workspace "/sbin/my_init" 5 minutes ago Up 5 minutes 0.0.0.0:2222->22/tcp laradock_workspace_1
eefb58598ee5 laradock_postgres "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 0.0.0.0:5432->5432/tcp laradock_postgres_1
ea559a775854 docker:dind "dockerd-entrypoint.…" 5 minutes ago Up 5 minutes 2375/tcp laradock_docker-in-docker_1
docker-compose ps
returns 这些结果:
$ docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------------------------------
laradock_docker-in-docker_1 dockerd-entrypoint.sh Up 2375/tcp
laradock_nginx_1 /bin/bash /opt/startup.sh Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
laradock_php-fpm_1 docker-php-entrypoint php-fpm Up 9000/tcp
laradock_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
如有任何帮助,我们将不胜感激。
我想通了。我将我的 docker-compose 文件体积编辑为 /local/path/to/default.conf:/etc/nginx/sites-available
这是一个问题,因为 nginx 寻找 default.conf 文件,但卷标志将 sites-available 设置为文件。我认为 docker volume 会将文件符号链接到 site-available 目录而不是将其变成文件。
正确的卷语法应该是:
/local/path/to/default.conf:/etc/nginx/sites-available/default.conf
我收到错误消息:此页面无法正常工作
我 运行 在 Laradock 目录中执行以下命令,但当我转到本地主机时它没有连接。 docker-compose up -d nginx postgres
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
19433b191832 laradock_nginx "/bin/bash /opt/star…" 5 minutes ago Up 5 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp laradock_nginx_1
e7f68a9d841d laradock_php-fpm "docker-php-entrypoi…" 5 minutes ago Up 5 minutes 9000/tcp laradock_php-fpm_1
3c73fedff4aa laradock_workspace "/sbin/my_init" 5 minutes ago Up 5 minutes 0.0.0.0:2222->22/tcp laradock_workspace_1
eefb58598ee5 laradock_postgres "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 0.0.0.0:5432->5432/tcp laradock_postgres_1
ea559a775854 docker:dind "dockerd-entrypoint.…" 5 minutes ago Up 5 minutes 2375/tcp laradock_docker-in-docker_1
docker-compose ps
returns 这些结果:
$ docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------------------------------
laradock_docker-in-docker_1 dockerd-entrypoint.sh Up 2375/tcp
laradock_nginx_1 /bin/bash /opt/startup.sh Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
laradock_php-fpm_1 docker-php-entrypoint php-fpm Up 9000/tcp
laradock_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
如有任何帮助,我们将不胜感激。
我想通了。我将我的 docker-compose 文件体积编辑为 /local/path/to/default.conf:/etc/nginx/sites-available
这是一个问题,因为 nginx 寻找 default.conf 文件,但卷标志将 sites-available 设置为文件。我认为 docker volume 会将文件符号链接到 site-available 目录而不是将其变成文件。
正确的卷语法应该是:
/local/path/to/default.conf:/etc/nginx/sites-available/default.conf