mirror of
/repos/baseimage-docker.git
synced 2026-02-26 17:32:03 +01:00
Added a workaround for Docker's inability to modify /etc/hosts in the container.
See Docker bug 2267: https://github.com/dotcloud/docker/issues/2267
This commit is contained in:
@@ -56,6 +56,9 @@ def is_exe(path):
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
def create_hosts_file():
|
||||
run_command_killable("/bin/cp", "/etc/hosts", "/etc/workaround-docker-2267/")
|
||||
|
||||
def import_envvars(clear_existing_environment = True, override_existing_environment = True):
|
||||
new_env = {}
|
||||
for envfile in listdir("/etc/container_environment"):
|
||||
@@ -249,6 +252,7 @@ def install_insecure_key():
|
||||
run_command_killable("/usr/sbin/enable_insecure_key")
|
||||
|
||||
def main(args):
|
||||
create_hosts_file()
|
||||
import_envvars(False, False)
|
||||
export_envvars()
|
||||
|
||||
|
||||
2
image/bin/workaround-docker-2267
Executable file
2
image/bin/workaround-docker-2267
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec /usr/bin/perl -pi -e 's:/etc/hosts:/cte/hosts:g' /lib/x86_64-linux-gnu/libnss_files.so.2
|
||||
@@ -30,6 +30,12 @@ ln -sf /bin/true /sbin/initctl
|
||||
dpkg-divert --local --rename --add /usr/bin/ischroot
|
||||
ln -sf /bin/true /usr/bin/ischroot
|
||||
|
||||
## Workaround https://github.com/dotcloud/docker/issues/2267,
|
||||
## not being able to modify /etc/hosts.
|
||||
mkdir -p /etc/workaround-docker-2267
|
||||
ln -s /etc/workaround-docker-2267 /cte
|
||||
cp /build/bin/workaround-docker-2267 /usr/bin/
|
||||
|
||||
## Install HTTPS support for APT.
|
||||
$minimal_apt_get_install apt-transport-https ca-certificates
|
||||
|
||||
|
||||
Reference in New Issue
Block a user