In order to build a golang development environment with docker, dockerfile was set as follows. However, as shown in [2. Error details](# 2. Error details), it could not be built. .. .. I will leave it as a memorandum!
dockerfile
#reference
FROM golang:latest
ENV GO111MODULE=on
ENV GOLANG_VERSION=1.15.3
WORKDIR /go/src/backend
#This apt-get doesn't work ...
RUN apt-get update -y && apt-get install -y vim
COPY /backend/go.mod /backend/go.sum /go/src/backend/
docker-compose build doesn't work.
[root@localhost vagrant]# docker-compose build
nginx uses an image, skipping
Building vue
Step 1/2 : FROM node:10
---> 56387899b840
Step 2/2 : RUN apt-get update && apt-get install git && npm install -g npm && npm install -g @vue/cli
---> Using cache
---> 2f3aa344d453
Successfully built 2f3aa344d453
Successfully tagged vagrant_vue:latest
Building go
Step 1/7 : FROM golang:latest
---> 4a581cd6feb1
Step 2/7 : ENV GO111MODULE=on
---> Using cache
---> dfe811dc936e
Step 3/7 : ENV GOLANG_VERSION=1.15.3
---> Using cache
---> dc7206ac34f4
Step 4/7 : ENV GOPATH=/go
---> Using cache
---> 73183c5707e4
Step 5/7 : WORKDIR /go/src/backend
---> Using cache
---> a3cb200b2052
Step 6/7 : RUN apt-get update -y && apt-get install -y vim
---> Running in a57f9a0f8c5f
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 Packages [7906 kB]
Reading package lists...
E: Release file for http://security.debian.org/debian-security/dists/buster/updates/InRelease is not valid yet (invalid for another 1d 8h 21min 59s). Updates for this repository will not be applied.
E: Release file for http://deb.debian.org/debian/dists/buster-updates/InRelease is not valid yet (invalid for another 2d 0h 11min 1s). Updates for this repository will not be applied.
ERROR: Service 'go' failed to build : The command '/bin/sh -c apt-get update -y && apt-get install -y vim' returned a non-zero code: 100
Looking here, the time setting seems to be bad. .. ..
E: Release file for http://security.debian.org/debian-security/dists/buster/updates/InRelease is not valid yet (invalid for another 1d 8h 21min 59s). Updates for this repository will not be applied.
E: Release file for http://deb.debian.org/debian/dists/buster-updates/InRelease is not valid yet (invalid for another 2d 0h 11min 1s). Updates for this repository will not be applied.
Is the time of the host OS (CentOS7 in this case) wrong ??
$date
Thu Oct 22 17:49:15 JST 2020
The work date and time was around 22:00 on October 24th, so there is no doubt that it is off. .. .. Try changing the host OS to the current time by referring to the following site. ** Reference article name: Set the Linux server time (with the current time) ** ** Reference URL: https://qiita.com/ntkgcj/items/0ef1c02665b3d9a3971d **
$ docker-compose build
Building go
Step 1/7 : FROM golang:latest
---> 4a581cd6feb1
Step 2/7 : ENV GO111MODULE=on
---> Using cache
---> dfe811dc936e
Step 3/7 : ENV GOLANG_VERSION=1.15.3
---> Using cache
---> dc7206ac34f4
Step 4/7 : ENV GOPATH=/go
---> Using cache
---> 73183c5707e4
Step 5/7 : WORKDIR /go/src/backend
---> Using cache
---> a3cb200b2052
Step 6/7 : RUN apt-get update -y && apt-get install -y vim
---> Running in e5e484eea0df
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [243 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7906 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7868 B]
···abridgement
Successfully tagged vagrant_go:latest
** Build successful! !! ** **
Recommended Posts