当我运行命令docker compose-up时,在docker中遇到问题



我是docker的新手,当我运行命令docker compose up时,中的错误如下

+ gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 33CFC8B3 from hkp server ha.pool.sks-keyservers.net
?: ha.pool.sks-keyservers.net: Host not found
gpgkeys: HTTP fetch error 7: couldn't connect: Connection timed out
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
ERROR: Service 'php' failed to build: The command '/bin/sh -c set -xe   && for key in $GPG_KEYS; do         gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys "$key";     done' returned a non-zero code: 2

我在这里附上了我的docker yml文件,有人能帮我解决这个问题吗?

application:
build: misc/docker/code
volumes:
- .:/var/www/seagull
tty: true
db:
image: mysql:5.6
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: toor
redis:
image: redis
ports:
- 6379:6379
php:
build: misc/docker/php-fpm/5.6
expose:
- "9000"
volumes_from:
- application
links:
- db
- redis
environment:
- REDIS_BACKEND=redis:6379
nginx:
build: misc/docker/nginx
ports:
- 80:80
links:
- php
volumes_from:
- application
volumes:
- ./var/log/nginx:/var/log/nginx
不幸的是,

密钥服务器问题非常常见——尝试多种不同的方法,在大规模解决该问题方面唯一合理成功的方法是在循环中尝试多个密钥服务器,直到其中一个成功。通常,只要重新启动失败的构建就足以使其正常工作,但可能会有防火墙等强制密钥服务器切换(keyserver.ubuntu.com是一个很好的支持端口80的版本,通常是允许的(。

@ptsiampas通过从多个服务器获取解决方案。。

key='B42F6819007F00F88E364FD4036A9C25BF357DD4'; 
gpg  --yes --always-trust --keyserver pgp.mit.edu --recv-keys "$key" || 
gpg  --yes --always-trust --keyserver keyserver.pgp.com --recv-keys "$key" || 
gpg  --yes --always-trust --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; 
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; 

@camilo0365通过这种方式解决了这个问题。

for server in ha.pool.sks-keyservers.net 
hkp://p80.pool.sks-keyservers.net:80 
keyserver.ubuntu.com 
hkp://keyserver.ubuntu.com:80 
pgp.mit.edu; do
gpg --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || echo "Trying new server..."
done

你可以使用代理,来解决你的问题。

gpg --keyserver-options http-proxy="http://XXXXXXX" 
--keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

也适用于

ERROR: Service 'php' failed to build:

尝试docker-compose build --no-cache php-fpm

相关内容

  • 没有找到相关文章

最新更新