Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
3
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

@kawaz

Dockerバイナリを最新にする

ここに書くメモは凄く雑なやり方です。本来は rpm パッケージが上がるのを待つか、自分で rpm パッケージを作っていれるべきと思われます。

Docker 17.05 の新機能のマルチステージビルドをしたかった

マルチステージビルドってのは↓こういうDockerfileが書けるようにする機能ね(FROM xx AS buildCOPY --from=build 辺り)

FROM golang:1.8.3 AS build
WORKDIR /go/src/github.com/kawaz/foo
COPY glide.yaml glide.lock .
RUN glide install
COPY . .
RUN CGO_ENABLE=0 GOOS=linux go build -a -tags netgo -installsuffix netgo --ldflags '-extldflags "-static"' && rm -rf vendor .glide

FROM alpine
RUN apk add --no-cache --update tzdata ca-certificates curl
WORKDIR /app
COPY --from=build /go/src/github.com/kawaz/foo/foo .
CMD [ "./foo" ]

AmazonLinux の Docker は 17.03 だったのでバイナリ差し替えで上げた(エントリ投稿時点で 17.06.2-ce が入った)

sudo service docker stop
curl -sL \
  "https://download.docker.com/linux/static/stable/x86_64/$(curl -s https://download.docker.com/linux/static/stable/x86_64/|grep -oE 'docker-[0-9\.]+-ce.tgz' | sort -Vr | head -n1)" | \
  sudo tar xz -C /usr/bin --strip=1 'docker/docker*'
sudo service docker start

アーカイブの中身は以下のような感じにバイナリが8個入ってるだけなのでこれを /usr/bin に上書きで突っ込んでただけ。

  • docker/docker
  • docker/docker-containerd
  • docker/docker-containerd-ctr
  • docker/docker-containerd-shim
  • docker/docker-init
  • docker/docker-proxy
  • docker/docker-runc
  • docker/dockerd
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
3
Help us understand the problem. What are the problem?