Skip to content

Instantly share code, notes, and snippets.

@bdha
Created May 30, 2020 21:35
Show Gist options
  • Save bdha/836dc86ef28de170252e8231cdbeb1ad to your computer and use it in GitHub Desktop.
Save bdha/836dc86ef28de170252e8231cdbeb1ad to your computer and use it in GitHub Desktop.

https://cloud.google.com/container-registry/docs/quickstart

Make sure you have the gcloud tools setup, and then run:

gcloud auth configure-docker
17:25:35 eos:~/src/fastly/kryten-api$ git checkout jemershaw/docker
...
17:27:14 eos:~/src/fastly/kryten-api$ docker build --tag fastly/kryten-api:first .
...
17:29:05 eos:~/src/fastly/kryten-api$ docker tag fastly/kryten-api:first gcr.io/hardware-eng/kryten-api:first
17:29:12 eos:~/src/fastly/kryten-api$ docker push gcr.io/hardware-eng/kryten-api:first
The push refers to repository [gcr.io/hardware-eng/kryten-api]
75a36141a1ad: Pushed 
7972c70a56dd: Pushed 
9f7e620b6292: Pushed 
45a046c531a4: Pushed 
7f2ca18163c5: Pushed 
64e2edb867c5: Pushed 
d63c88281d4e: Pushed 
a4507fabd147: Pushed 
first: digest: sha256:820d935bf154c427a39e46f8e9fa44c8e5c48e88a85f9a65300b7543815dbfa1 size: 1995
17:32:50 eos:~/src/fastly/kryten-api$ 
17:32:50 eos:~/src/fastly/kryten-api$ docker images | grep kryten
fastly/kryten-api                         first                  a05ce6f2662a        8 minutes ago       978MB
gcr.io/hardware-eng/kryten-api            first                  a05ce6f2662a        8 minutes ago       978MB
fastly/kryten-dummyplug                   latest                 39f4c22ed37c        12 days ago         398MB
17:33:59 eos:~/src/fastly/kryten-api$ docker rmi fastly/kryten-api:first
Untagged: fastly/kryten-api:first
17:34:42 eos:~/src/fastly/kryten-api$ docker run gcr.io/hardware-eng/kryten-api:first
Server available at http://127.0.0.1:3000
XS.c: loadable library and perl binaries are mismatched (got handshake key 0xcd00080, needed 0xce00080)

That error probably means the carton cache was built locally instead of inside the container, and they aren't running the same distro version.

The dummyplug Dockerfile does this:

RUN rm -r /app/dummyplug/local
RUN carton && rm -r local/cache && rm -r ~/.cpanm
@bdha
Copy link
Author

bdha commented May 30, 2020

Fixed dockerfile: https://github.com/fastly/kryten-api/pull/135/commits/1ff852c71ea8d74de4063eb2cf579fba3794eb53

17:57:48 eos:~/src/fastly/kryten-api$ docker build -t fastly/kryten-api:first .
...
18:02:16 eos:~/src/fastly/kryten-api$ docker tag fastly/kryten-api:first gcr.io/hardware-eng/kryten-api:first
18:02:35 eos:~/src/fastly/kryten-api$ docker push gcr.io/hardware-eng/kryten-api:first
...
18:06:15 eos:~/src/fastly/kryten-api$ docker run gcr.io/hardware-eng/kryten-api:first
Server available at http://127.0.0.1:3000
18:08:32 eos:~$ docker inspect $( docker ps | grep kryten-api | awk '{print $1}' ) | jq '.[].NetworkSettings.IPAddress'
"172.17.0.2"

18:08:47 eos:~$ http 172.17.0.2:3000/ping
HTTP/1.1 200 OK
Content-Length: 15
Content-Type: application/json;charset=UTF-8
Date: Sat, 30 May 2020 22:08:58 GMT
Server: Mojolicious (Perl)

{
    "status": "ok"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment