
#osx-docker-apache-php, a.k.a dgraziotin/apache-php As of Docker for Mac v1.12.0, there is no need for using my Docker images anymore. Thanks for the support!
Out-of-the-box Apache+PHP Docker image that *just works* on Mac OS X. Including write support for mounted volumes (Website). No matter if using the official boot2docker or having Vagrant in the stack, as well.
osx-docker-apache-php, which is known as https://registry.hub.docker.com/u/dgraziotin/apache-php/ is a reduced fork of https://github.com/dgraziotin/osx-docker-lamp, which is an "Out-of-the-box LAMP image (PHP+MySQL) for Docker".
Some info about osx-docker-apache-php:
##Usage
If using Vagrant, please see the extra steps in the next subsection.
docker build -t youruser/apache-php .
If you wish, you can push your new image to the registry:
docker push youruser/apache-php
Otherwise, you are free to use dgraziotin/apache-php as it is provided. Remember first to pull it from the Docker Hub:
docker pull dgraziotin/apache-php
###Vagrant
If, for any reason, you would rather use Vagrant (I suggest using https://github.com/AntonioMeireles/boot2docker-vagrant-box), you need to add the following three variables when running your box:
-VAGRANT_OSX_MODE="true" for enabling Vagrant-compatibility
-DOCKER_USER_ID=$(id -u) for letting Vagrant use your host user ID for mounted folders
-DOCKER_USER_GID=$(id -g) for letting Vagrant use your host user GID for mounted folders
See the Environment variables section for more options.
###Running your Apache+PHP docker image
If you start the image without supplying your code, e.g.,
docker run -t -i -p 80:80 --name website dgraziotin/apache-php
At http://[boot2docker ip, e.g., 192.168.59.103] you should see an "Hello world!" page.
###Loading your custom PHP application
In order to replace the Hello World application that comes bundled with this docker image, my suggested layout is the following:
The app folder should contain the root of your PHP application.
Run the following code from within the Project name folder.
docker run -i -t -p "80:80" -v ${PWD}/app:/app --name yourwebapp dgraziotin/apache-php
Test your deployment:
http://[boot2docker ip]
##Environment description
###The /app folder
Apache is configured to serve the files from the /app folder, which is a symbolic
link to /var/www/html. In osx-docker-apache-php, the apache user www-data
has full write permissions to the app folder.
###Apache
Apache is pretty much standard in this image. It is configured to serve the Web app
at app as / and phpMyAdmin as /phpmyadmin. Mod rewrite is enabled.
Apache runs as user www-data and group staff. The write support works because the user www-data is configured to have the same user id as the one employed by boot2docker (1000).
##Environment variables
APACHE_ROOT tells Apache which folder within the app volume so serve as the web root.PHP_UPLOAD_MAX_FILESIZE="10M" will change PHP upload_max_filesize config valuePHP_POST_MAX_SIZE="10M" will change PHP post_max_size config value
-VAGRANT_OSX_MODE="true" for enabling Vagrant-compatibility
-DOCKER_USER_ID=$(id -u) for letting Vagrant use your host user ID for mounted folders
-DOCKER_USER_GID=$(id -g) for letting Vagrant use your host user GID for mounted foldersSet these variables using the -e flag when invoking the docker client.
docker run -i -t -p "80:80"-v ${PWD}/app:/app -e PHP_UPLOAD_MAX_FILESIZE="10M" --name yourwebapp dgraziotin/apache-php
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。




探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务