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

Error when using host:port in a FROM instruction #355

Open
2 of 3 tasks
ArnaudGallardo opened this issue Oct 7, 2019 · 4 comments · May be fixed by hadolint/language-docker#75
Open
2 of 3 tasks

Error when using host:port in a FROM instruction #355

ArnaudGallardo opened this issue Oct 7, 2019 · 4 comments · May be fixed by hadolint/language-docker#75
Labels

Comments

@ArnaudGallardo
Copy link

ArnaudGallardo commented Oct 7, 2019

  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

The linter should run on Dockerfiles that use a custom registry with the following format host:port.

Actual behavior

Returns an error before running any linting checks: unexpected ':' expecting '@', a new line followed by the next instruction, at least one space, or the image tag.

Steps to reproduce the behavior

Create the following Dockerfile:

FROM myregistry:443/imagename:tag

Run docker run --rm -i hadolint/hadolint < Dockerfile.

The error will be triggered.

If you add a .anything after myregistry or if you remove :443 it will work.

Output of hadolint --version or
docker run --rm hadolint/hadolint hadolint --version:

Haskell Dockerfile Linter v1.17.2-8-g65736cb

Dockerfile (if relevant)

FROM myregistry:443/imagename:tag

We are using an Artifactory repository on a local network, that's why we have a host:port registry.

@quixoticmonk
Copy link

Noticing the same in one of our cases too with Nexus registries. Since this is an open issue, I am assuming there is not a fix in the latest versions. Can I add an ignore on this by any means ? Thank you

@lorenzo
Copy link
Member

lorenzo commented Jun 5, 2020

There is no workaround, unfortunately, it is a deficiency in the parser. I'll include this fix for next version

@lorenzo lorenzo added the bug label Jun 5, 2020
@quixoticmonk
Copy link

Thanks @lorenzo .

@srcshelton
Copy link

In addition, I have a multi-stage Dockerfile containing:

ARG stage3_image="gentoo/stage3-amd64"
ARG stage3_name="gentoo-stage3"

FROM "${stage3_name:-gentoo-stage3}:latest"

... which also generates the same error, for character 36 (:) of the FROM line.

Version Haskell Dockerfile Linter v1.18.0-6-ga0d655d run via docker/podman.

petitlapin added a commit to petitlapin/language-docker that referenced this issue Oct 29, 2021
when having a FROM line like: `FROM myregistry:port/imagename:tag`, there is an error `unexpected ':' expecting '@', a new line followed by the next instruction, at least one space, or the image tag`.
This patch proposes to simplify how the registry is computed.
fixes: hadolint/hadolint#355

I don't know haskell, I tested the change by cloning the repo, and testing on a local file using the test in integration-tests
petitlapin added a commit to petitlapin/language-docker that referenced this issue Oct 29, 2021
petitlapin added a commit to petitlapin/language-docker that referenced this issue Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants