Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac 下运行后 报错.... 好像是apt-get update 出错 网上的方法都试了不行 有啥方法解决吗 #3

Closed
ihziluoh opened this issue Sep 17, 2017 · 6 comments

Comments

@ihziluoh
Copy link

Hlz-Mac:docker ihziluoh$ cd dnmp-master/
Hlz-Mac:dnmp-master ihziluoh$ docker-compose up
Building php-fpm
Step 1/16 : FROM php:fpm
---> 9b44e8b4c8b6
Step 2/16 : RUN apt-get update
---> Running in 83ad66ef7db6
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [391 kB]
Get:4 http://deb.debian.org jessie Release.gpg [2373 B]
Get:5 http://deb.debian.org jessie-updates/main amd64 Packages [23.1 kB]
Get:6 http://deb.debian.org jessie Release [148 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9035 kB]
W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages Hash Sum mismatch

Fetched 9808 kB in 11s (839 kB/s)
W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c apt-get update' returned a non-zero code: 100

@yeszao
Copy link
Owner

yeszao commented Sep 20, 2017

Dockfile文件顶部有两行:

# RUN export http_proxy=192.168.1.10:1080
# RUN export https_proxy=192.168.1.10:1080

取消注释,proxy IP换成可用的IP。

@ihziluoh
Copy link
Author

还是不行 我换成本机的ip 取消注释 报的错误还是一样.....

@yeszao
Copy link
Owner

yeszao commented Sep 20, 2017

这里的IP是指可访问外国网的代理IP。
或者在docker-compose.yml文件的php-fpm块给容器加上DNS,如:

  dns
    - 8.8.8.8
    - 8.8.4.4

@ihziluoh
Copy link
Author

还是不行 我都快崩溃了 别人都没遇到这个问题嘛 。。。。坑
php-fpm:
build: .
expose:
- "9000"
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- ./www/:/var/www/html/:rw
- ./conf/php/php.ini:/usr/local/etc/php/php.ini:ro
- ./conf/php/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./log/php-fpm/:/var/log/php-fpm/:rw
links:
- mysql:mysql

Get:8 http://deb.debian.org jessie/main amd64 Packages [9035 kB]
Fetched 9788 kB in 5min 57s (27.3 kB/s)
W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages Hash Sum mismatch

W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c apt-get update' returned a non-zero code: 100

@ihziluoh
Copy link
Author

在Dockerfile 改了下源 之前不行 这次尝试又可以了。。。。。。

FROM php:fpm

You may need proxy

#RUN export http_proxy=192.168.1.10:1080
#RUN export https_proxy=192.168.1.10:1080

RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak

RUN echo "deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib" >> /etc/apt/sources.list

@yeszao
Copy link
Owner

yeszao commented Sep 29, 2017

OK,这个问题主要和网络环境,DNS解析,以及ubuntu容器的源有关。

@yeszao yeszao closed this as completed Oct 23, 2017
hushulin pushed a commit to hushulin/dnmp that referenced this issue Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants