The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

David M. Karr (83) [Avatar] Offline
Section "6.2.1. Using an emptyDir volume" has a problem that I ran into in earlier sections, and will probably hit many more times. The build of the "fortune" image fails when run behind a proxy.

I see the following:

Get:2 xenial InRelease [14.8 kB]
Err:1 xenial-security InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)

The fix is to configure the image so that apt has proxy information. This could be done by writing a custom apt.conf file to dump into the image, but it's likely easier to just set the http_proxy and https_proxy environment variables in the Dockerfile, making sure they are BEFORE the apt calls, like this:

FROM ubuntu:latest
ENV http_proxy "http://proxyhost:proxyport"
ENV https_proxy "http://proxyhost:proxyport"
RUN apt-get update ; apt-get -y install fortune
ADD /bin/
Marko Lukša (70) [Avatar] Offline
It may be better to set build-time environment variables by running the build like this:

docker build --build-arg http_proxy=... -t myimage .

This way, if you build the image behind a corporate proxy, but then someone runs it outside of the company, the containers created from the image will not use the proxy. If you set the environment variables in the Dockerfile, they would also be set every time the container runs.