'getting issue in docker when i run command docker compose up
i am new in docker, when i run the command docker-compose up i am getting below error in that
+ 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
here i have attached my docker yml file, can anyone please help me how to resolve this issue ?
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
Solution 1:[1]
Keyserver issues are unfortunately very common -- Try a number of different methods, and the only method that's reasonably successful at combating the issue on a large scale is trying multiple keyservers in a loop until one succeeds. Usually, just re-starting the failing build is enough to get it to work, but there may be firewalls, etc in place that force a keyserver switch (keyserver.ubuntu.com is a good one that supports port 80 and is commonly allowed).
@ptsiampas Solved by getting it from multiple servers..
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 Solved it in this way.
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
you can use proxy, to solve your problem.
gpg --keyserver-options http-proxy="http://XXXXXXX"
--keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Also for
ERROR: Service 'php' failed to build:
try docker-compose build --no-cache php-fpm
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ARANYA MUKHERJEE |
