Tôi không thể thực thi bất kỳ lệnh nào yêu cầu kết nối internet bên trong bất kỳ container Docker nào.
Làm:
docker run ubuntu /bin/echo 'Hello world'
Không hoạt động:
docker run ubuntu apt-get update
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
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-security/InRelease Temporary failure resolving 'archive.ubuntu.com'
Tương tự với pipvà ping.
Tôi đang dùng Ubuntu 16.04 và không sử dụng tường lửa hoặc máy chủ proxy công ty và đã thử khởi động lại Docker.
Cập nhật:
Cập nhật trong chế độ tương tác thất bại trong cùng một thời gian.
docker exec -ti angry_goodall /bin/bash
apt-get update
#fails
ping google.com
#fails with "unknown host" message
ping 8.8.8.8
# shows PING 8.8.8.8 (8.8.8.8): 56 data bytes
# and than hangs indefinetly
sudo apt-get update chạy thành công trên máy chủ, tức là trên máy tính của tôi bên ngoài docker.
Cập nhật Docker phiên bản 1.12.1, bản dựng 23cf638
apt-get updatetrong khi ở chế độ tương tác với docker?