在运行“ apt-get update -yqq”时使用docker-compose构建新工作区时出错

问题描述 投票:-1回答:1

我正在Ubuntu 18.04中使用Laradock设置一个新项目。我确认正确安装了docker-compose并正确下载了映像。运行时

$ sudo docker-compose up -d mysql nginx phpmyadmin redis php-worker

它返回以下错误:

+ apt-get update -yqq

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

运行命令'docker-compose up'后:

path_to_laradock/laradock$ sudo docker-compose up -d mysql nginx phpmyadmin redis php-worker
Building workspace
Step 1/251 : ARG LARADOCK_PHP_VERSION
Step 2/251 : FROM laradock/workspace:2.6.1-${LARADOCK_PHP_VERSION}
 ---> 9e3231c96fa9
Step 3/251 : LABEL maintainer="Mahmoud Zalt <[email protected]>"
 ---> Using cache
 ---> 2a0571fff132
Step 4/251 : ARG LARADOCK_PHP_VERSION
 ---> Using cache
 ---> fd7c28e61b6c
Step 5/251 : ENV DEBIAN_FRONTEND noninteractive
 ---> Using cache
 ---> 8dfd11e8a07b
Step 6/251 : ARG CHANGE_SOURCE=false
 ---> Using cache
 ---> f72c34b26b28
Step 7/251 : RUN if [ ${CHANGE_SOURCE} = true ]; then     sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list &&     sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list &&     sed -i 's/security-cdn.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list ;fi
 ---> Using cache
 ---> c8325ad16886
Step 8/251 : USER root
 ---> Using cache
 ---> c36347410846
Step 9/251 : ARG PUID=1000
 ---> Using cache
 ---> 37bb8c1e61cf
Step 10/251 : ENV PUID ${PUID}
 ---> Using cache
 ---> b6076ea8d56f
Step 11/251 : ARG PGID=1000
 ---> Using cache
 ---> 05e5eb9ee8a7
Step 12/251 : ENV PGID ${PGID}
 ---> Using cache
 ---> e0987ed2353e
Step 13/251 : ARG CHANGE_SOURCE=false
 ---> Using cache
 ---> 4e13d59b9edc
Step 14/251 : ARG UBUNTU_SOURCE
 ---> Using cache
 ---> 5dfae87036c0
Step 15/251 : COPY ./sources.sh /tmp/sources.sh
 ---> Using cache
 ---> 077233c36a6e
Step 16/251 : RUN if [ ${CHANGE_SOURCE} = true ]; then     /bin/sh -c /tmp/sources.sh &&     rm -rf /tmp/sources.sh ;fi
 ---> Using cache
 ---> e58f5c8ce0f8
Step 17/251 : RUN set -xe;     apt-get update -yqq &&     pecl channel-update pecl.php.net &&     groupadd -g ${PGID} laradock &&     useradd -u ${PUID} -g laradock -m laradock -G docker_env &&     usermod -p "*" laradock -s /bin/bash &&     apt-get install -yqq       apt-utils       libzip-dev zip unzip       php${LARADOCK_PHP_VERSION}-zip       nasm &&       php -m | grep -q 'zip'
 ---> Running in df3b3e0be1e9
+ apt-get update -yqq

哪个配置文件可能导致错误?谢谢!

docker ubuntu docker-compose apt laradock
1个回答
0
投票

这是DNS的问题。

在'/ etc / default /'中修改'docker'文件后,我更改了默认DNS。我恢复了默认值,一切恢复正常。

看起来像这样:

# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
© www.soinside.com 2019 - 2024. All rights reserved.