
Maintained by:
https://github.com/alcohol, with https://github.com/composer/docker/graphs/contributors from the community.
Where to get help:
the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow
Dockerfile linkshttps://github.com/composer/docker/blob/87286c1d448a5e39551354771ddf0c7db252cc01/latest/Dockerfile
https://github.com/composer/docker/blob/27baac864c3316f44b2097acb1454f335e182cac/2.2/Dockerfile
Where to file issues:
https://github.com/composer/docker/issues?q=
Supported architectures: (https://github.com/docker-library/official-images#architectures-other-than-amd64)
https://hub.docker.com/r/amd64/composer/, https://hub.docker.com/r/arm32v6/composer/, https://hub.docker.com/r/arm32v7/composer/, https://hub.docker.com/r/arm64v8/composer/, https://hub.docker.com/r/i386/composer/, https://hub.docker.com/r/ppc64le/composer/, https://hub.docker.com/r/riscv64/composer/, https://hub.docker.com/r/s390x/composer/
Published image artifact details:
https://github.com/docker-library/repo-info/blob/master/repos/composer (https://github.com/docker-library/repo-info/commits/master/repos/composer)
(image metadata, transfer size, etc)
Image updates:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fcomposer
https://github.com/docker-library/official-images/blob/master/library/composer (https://github.com/docker-library/official-images/commits/master/library/composer)
Source of this description:
https://github.com/docker-library/docs/tree/master/composer (https://github.com/docker-library/docs/commits/master/composer)
Composer is a tool for dependency management in PHP, written in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
You can read more about Composer in our official documentation.
!https://raw.githubusercontent.com/docker-library/docs/58f7363e6cfa78f8cd54af16eab51c63c***/composer/logo.png
console$ docker run --rm --interactive --tty \ --volume $PWD:/app \ composer <command>
You can bind mount the Composer home directory from your host to the container to enable a persistent cache or share global configuration:
console$ docker run --rm --interactive --tty \ --volume $PWD:/app \ --volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \ composer <command>
Note: this relies on the fact that the COMPOSER_HOME value is set to /tmp in the image by default.
Or if your environment follows the XDG specification:
console$ docker run --rm --interactive --tty \ --env COMPOSER_HOME \ --env COMPOSER_CACHE_DIR \ --volume ${COMPOSER_HOME:-$HOME/.config/composer}:$COMPOSER_HOME \ --volume ${COMPOSER_CACHE_DIR:-$HOME/.cache/composer}:$COMPOSER_CACHE_DIR \ --volume $PWD:/app \ composer <command>
By default, Composer runs as root inside the container. This can lead to permission issues on your host filesystem. You can work around this by running the container with a different user:
console$ docker run --rm --interactive --tty \ --volume $PWD:/app \ --user $(id -u):$(id -g) \ composer <command>
See: [***] for details.
Note: Docker for Mac behaves differently and this tip might not apply to Docker for Mac users.
When you need to access private repositories, you will either need to share your configured credentials, or mount your ssh-agent socket inside the running container:
console$ eval $(ssh-agent); \ docker run --rm --interactive --tty \ --volume $PWD:/app \ --volume $SSH_AUTH_SOCK:/ssh-auth.sock \ --env SSH_AUTH_SOCK=/ssh-auth.sock \ composer <command>
Note: On OSX this requires Docker For Mac v2.2.0.0 or later, see https://github.com/docker/for-mac/issues/410.
When combining the use of private repositories with running Composer as another user, you can run into non-existent user errors (thrown by ssh). To work around this, bind mount the host passwd and group files (read-only) into the container:
console$ eval $(ssh-agent); \ docker run --rm --interactive --tty \ --volume $PWD:/app \ --volume $SSH_AUTH_SOCK:/ssh-auth.sock \ --volume /etc/passwd:/etc/passwd:ro \ --volume /etc/group:/etc/group:ro \ --env SSH_AUTH_SOCK=/ssh-auth.sock \ --user $(id -u):$(id -g) \ composer <command>
Our image is aimed at quickly running Composer without the need for having a PHP runtime installed on your host. You should not rely on the PHP version in our container. We do not provide a Composer image for each supported PHP version because we do not want to encourage using Composer as a base image or a production image.
We try to deliver an image that is as lean as possible, built for running Composer only. Sometimes dependencies or Composer scripts require the availability of certain PHP extensions.
Suggestions:
(optimal) create your own build image and install Composer inside it.
Note: Docker 17.05 introduced multi-stage builds, simplifying this enormously:
dockerfileCOPY --from=composer /usr/bin/composer /usr/bin/composer
(alternatively) specify the target platform / extension(s) in your composer.json:
json{ "config": { "platform": { "php": "MAJOR.MINOR.PATCH", "ext-something": "MAJOR.MINOR.PATCH" } } }
(discouraged) pass the --ignore-platform-reqs and / or --no-scripts flags to install or update:
console$ docker run --rm --interactive --tty \ --volume $PWD:/app \ composer install --ignore-platform-reqs --no-scripts
View https://github.com/composer/composer/blob/master/LICENSE for the software contained in this image.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
Some additional license information which was able to be auto-detected might be found in https://github.com/docker-library/repo-info/tree/master/repos/composer.
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
以下是 composer 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 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 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务