I have tried to put my environment variable at /var/lib/boot2docker/profile file at guest machine, and restart it
export http_proxy=http://proxy:port
then i open shell from my host machine (Windows 7) by using
docker-machine ssh default
I can't find 'http_proxy' from my environment variable by using
env
When PHPdocker.io generates a docker-compose.yml file, it also puts in a section for the environment variables.
It starts running Docker-compose from the Vagrantfile:
and if you aren't using docker-compose you could also arrange to put an appropriate file (like @Matt's
/etc/profile.d/proxy.sh
) into the virtual machine as it is being provisioned (with theconfig.vm.provision "shell"
), rather than manually adding it later.You can create a custom virtual machine with proxy configuration like this
It will create a virtual machine with permanent proxy configuration.
The
docker
daemon sources/var/lib/boot2docker/profile
before starting. TheHTTP_PROXY
variable will be available in thedocker
daemons environment. Users logging in viassh
will not see this variable.Any
/etc/profile.d/*.sh
files will be loaded into a users profile at login but as you pointed out, this is reset back to the base image after every reboot.The
/var/lib/boot2docker/
directory contains the files that are persisted over reboots. Thebootlocal.sh
will be run at the end of startup.bootsync.sh
file will be run before docker.Edit
/var/lib/boot2docker/bootsync.sh
to includeThen the variable will be available for anything that logs in after
docker
has started for the first time.