Closed huolu closed 4 years ago
After flip the first 2 lines it works. Seems it doesn't agree with the docker document. (doesn't need the ARG VERSION line). https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact Anyway, it's not an issue, especially not for TTI.
Great that you managed to fix the issue.
FYI, this is exactly why we have these lines at the top in the Dockerfile
as well https://github.com/TheThingsIndustries/docker-protobuf/blob/34b1efa4988855ba73065180b54a7b8a23382f91/Dockerfile#L1-L5
Summary
I'm working on a project and start to learn/use protobuf as protocol. After imported docker-protobuf layer, I saw this error. To simplify the situation, I recreated a new workspace and only a minimum context is involved.
Steps to Reproduce
Use a simple Dockerfile as below: $ cat Dockerfile FROM thethingsindustries/protoc:latest as protobuf ARG CENTOS_VERSION=7.7.1908 FROM centos:$CENTOS_VERSION as osbase
Build it $ docker build . Sending build context to Docker daemon 16.38kB Step 1/3 : FROM thethingsindustries/protoc:latest as protobuf ---> 61425e1df8e3 Step 2/3 : ARG CENTOS_VERSION=7.7.1908 ---> Using cache ---> dc1d45376788 Step 3/3 : FROM centos:$CENTOS_VERSION as osbase invalid reference format
Error shows at the last line above
What do you see now?
See the example I posted in the Reproduce section.
What do you want to see instead?
If I removed the first line, then I see the $CENTOS_VERSION is being parsed correctly. $ docker build . Sending build context to Docker daemon 16.38kB Step 1/2 : ARG CENTOS_VERSION=7.7.1908 Step 2/2 : FROM centos:$CENTOS_VERSION as osbase ---> 08d05d1d5859 Successfully built 08d05d1d5859
Another, the doker-protobuf layer accepts ARG as tag itself. Here is another run: $ docker build . Sending build context to Docker daemon 16.38kB Step 1/4 : ARG TTI_VERSION=3.1.22 Step 2/4 : FROM thethingsindustries/protoc:$TTI_VERSION as protobuf ---> 43f36b10febe Step 3/4 : ARG CENTOS_VERSION=7.7.1908 ---> Using cache ---> b51117ba064d Step 4/4 : FROM centos:$CENTOS_VERSION as osbase invalid reference format
Environment
The docker version on my MacOS. (however, I see the same thing on a Centos VM.) $ docker version Client: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:21:11 2020 OS/Arch: darwin/amd64 Experimental: false
Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:29:16 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683
How do you propose to implement this?
I've been using Docker for a while but very new to docker-protobuf. Not sure if this is an issue but it looks odd to me.
Can you do this yourself and submit a Pull Request?
...