Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade docker cli to 18.06 #99

Merged
merged 3 commits into from
Nov 3, 2018
Merged

Upgrade docker cli to 18.06 #99

merged 3 commits into from
Nov 3, 2018

Conversation

seanprashad
Copy link
Contributor

Fixes #92: Multi-staged builds

To allow multi-staged builds, Docker 17.05 is required or higher is required on the daemon and the client. Documentation for Docker can be found here.

@seanprashad seanprashad changed the title Enable multi-staged builds [WIP] Enable multi-staged builds Oct 26, 2018
To allow multi-staged builds, Docker 17.05 is required or higher is
required on the daemon and the client.
@seanprashad
Copy link
Contributor Author

@tirumaraiselvan I've gone ahead and updated the release URL from 1.12.6 to 17.05. using the provided 64 bit linux tgz: https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce.tgz.

Please let me know if we can polish this up any further 😁

@seanprashad seanprashad changed the title [WIP] Enable multi-staged builds Enable multi-staged builds Oct 26, 2018
@tirumaraiselvan
Copy link
Collaborator

@seanprashad I am not able to build this. Try make build-all in root directory.

Basically this fails

curl -o /tmp/docker-17.05 'https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce.tgz'  && tar -xf /tmp/docker-17.05

tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

@seanprashad
Copy link
Contributor Author

seanprashad commented Oct 30, 2018

@tirumaraiselvan Something odd is up - even the old link for https://get.docker.com/builds/Linux/x86_64/docker-1.12.6.tgz is returning a 403.

I'm going to see why the download link has changed!

Update: Other users are experiencing this too: moby/moby#38105

&& mv /tmp/docker/docker /bin/docker \
&& rm -rf /tmp/docker-1.12 /tmp/docker \
&& rm -rf /tmp/docker-17.05 /tmp/docker \
Copy link

@thaJeztah thaJeztah Oct 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this can be simplified by using COPY --from, and copying the binary from the official Docker images.

For example; the following example pulls the docker:18.06.1 image (if it's not available locally), copies the docker to /bin/docker in a scratch image;

docker build -t docker-client -<<EOF
FROM scratch
COPY --from=docker:18.06.1 /usr/local/bin/docker /bin/docker
ENTRYPOINT ["/bin/docker"]
EOF

Which, when bind-mounting /var/run (to give access to the local daemon's socket), gives a functional docker cli;

$ docker run --rm -v /var/run/:/var/run/ docker-client version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:20:43 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     true

@@ -4,10 +4,10 @@ MAINTAINER tiru@hasura.io
# Install openssh server
RUN apt-get update \
&& apt-get install -y upx-ucl binutils curl openssh-server git jq \
&& curl -o /tmp/docker-1.12 'https://get.docker.com/builds/Linux/x86_64/docker-1.12.6.tgz' \
&& tar -xf /tmp/docker-1.12 -C /tmp \
&& curl -o /tmp/docker-17.05 'https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce.tgz' \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would discourage using docker 17.05 (that was an edge release, and does have some known vulnerabilities - given, those were in the daemon, not the CLI); current versions of docker can be found on download.docker.com (get.docker.com is no longer being updated with new versions); static amd64 (x86_64) binaries can be found (e.g.) here; https://download.docker.com/linux/static/stable/x86_64/

@seanprashad
Copy link
Contributor Author

seanprashad commented Oct 30, 2018

@tirumaraiselvan I've updated the docker image to 17.06.0-ce from https://download.docker.com/linux/static/stable/x86_64 and make build-all is successful on my local machine.

If you could pull down the latest commit and test it locally, that would be great!

@tirumaraiselvan
Copy link
Collaborator

@seanprashad Shouldn't we use version 18.06 since that is out now?

@seanprashad
Copy link
Contributor Author

Good idea @tirumaraiselvan! I've made the changes and rebuilt it locally with no errors:

screen shot 2018-10-31 at 11 14 33 am

If we can make this any better, please let me know! 😁

&& curl -o /tmp/docker-1.12 'https://get.docker.com/builds/Linux/x86_64/docker-1.12.6.tgz' \
&& tar -xf /tmp/docker-1.12 -C /tmp \
&& curl -o /tmp/docker-18.06 'https://download.docker.com/linux/static/stable/x86_64/docker-18.06.1-ce.tgz' \
&& tar -xf /tmp/docker-18.06 -C /tmp \
&& mv /tmp/docker/docker /bin/docker \
Copy link
Collaborator

@tirumaraiselvan tirumaraiselvan Nov 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason the server isn't upgrading even after changing the potentially buggy L9. I changed L9 to cp /tmp/docker/* /bin/ to copy all the binaries including dockerd yet:

root@gitkubed-6cf7744876-jwg2w:/# docker version
Client:
 Version:           18.06.1-ce
 API version:       1.27 (downgraded from 1.38)
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:20:43 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          17.03.2-ce
  API version:      1.27 (minimum version 1.12)
  Go version:       go1.9.2
  Git commit:       f5ec1e2
  Built:            Fri Aug 10 11:50:21 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the container just taking to the host daemon (through a bind-mounted /var/run/docker.sock? The Dockerfile only installs the docker cli, not the daemon

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Completely missed it :) Hmm, so no way to solve this if cloud providers don't give us newer docker.

@tirumaraiselvan tirumaraiselvan merged commit d0a5fdc into hasura:master Nov 3, 2018
@tirumaraiselvan
Copy link
Collaborator

Docker cli has been upgraded but will be ineffective if the underlying host docker is not > 17.06

@tirumaraiselvan tirumaraiselvan changed the title Enable multi-staged builds Upgrade docker cli to 18.06 Nov 3, 2018
@seanprashad seanprashad deleted the issue-92 branch November 3, 2018 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants