Error building docker images


(Andrew E) #1

I get the following error when building the Docker images to test a simple change to the docker image definition:

cd /var/discourse/image
ruby build.rb -b 1.4.1

...
2018-08-15 16:44:20,815 root         WARNING  An error occured while saving the sha256:24ffe1031f85707d9c9e623dea04258988df677efe6fe950e21e3ec9bd89fc99 image, retrying...
2018-08-15 16:44:20,816 root         INFO     Saving image sha256:24ffe1031f85707d9c9e623dea04258988df677efe6fe950e21e3ec9bd89fc99 to /tmp/docker-squash-3h9WWk/old directory...
2018-08-15 16:44:20,816 root         DEBUG    Try #2...
2018-08-15 16:54:20,927 root         ERROR    UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=600)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/docker_squash/image.py", line 352, in _save_image
    image = self.docker.get_image(image_id)
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/image.py", line 40, in get_image
    res = self._get(self._url("/images/{0}/get", image), stream=True)
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 198, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 525, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 526, in send
    raise ReadTimeout(e, request=request)
ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=600)

(Andrew E) #2

The build process doesn’t completely stop, but I do get this error:

SquashError: Couldn't save sha256:24ffe1031f85707d9c9e623dea04258988df677efe6fe950e21e3ec9bd89fc99 image!
2018-08-15 17:04:24,199 root         ERROR    Execution failed, consult logs above. If you think this is our fault, please file an issue: https://github.com/goldmann/docker-squash/is

(Rafael dos Santos Silva) #3

Oh looks like the docs are outdated big time there, sorry.

Can you please try using the auto_build script to build?

I put updating this docs in my list :spiral_notepad:


(Andrew E) #4

Hello Rafael,

When I try running that script, I get this erorr:

root@forum0d:/var/discourse/image# ruby auto_build.rb 
Traceback (most recent call last):
auto_build.rb:39:in `<main>': undefined method `intern' for nil:NilClass (NoMethodError)

root@forum0d:/var/discourse/image# which ruby
/usr/share/rvm/rubies/ruby-2.5.1/bin/ruby

Thanks for your help.

Andrew


(Rafael dos Santos Silva) #5

Please try with ruby auto_build.rb base for base image.


(Andrew E) #6

Hello Rafael,

I tried that, but am running into another error:

Building {:name=>“base”, :tag=>“discourse/base:build”, :squash=>true}
“–squash” is only supported on a Docker daemon with experimental
features enabled

Thanks,
Andrew


(Rafael dos Santos Silva) #7

Yes, we use the experimental squash flag to reduce final image size for our users.

You can either:

  • Enable experimental features in the Docker daemon

  • Change squash to false locally while you run ruby auto_build.rb base


(Andrew E) #8

Thanks, that worked. : )

I checked the name of the docker image via

docker images

then added

image=discourse/base:build

to /var/discourse/launcher and then ran

./launcher rebuild app