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

"--image-name" is ignored when devcontainer.json is using "image" statement #543

Open
cguentherTUChemnitz opened this issue Jun 2, 2023 · 1 comment · May be fixed by #586
Open

"--image-name" is ignored when devcontainer.json is using "image" statement #543

cguentherTUChemnitz opened this issue Jun 2, 2023 · 1 comment · May be fixed by #586

Comments

@cguentherTUChemnitz
Copy link

Hi there,

i was following this guide to setup our internal environment accordingly:
https://containers.dev/guide/gitlab-ci

This works correctly since the devcontainer.json contains the following part:

  "build": {
    "context": "..",
    "dockerfile": "Dockerfile"
  },

But as soon as i switch this to just referencing an image name instead of an dockerfile in the devcontainer.json, e.g. via:

"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",

The referenced image name via:

devcontainer build --workspace-folder . --push true --image-name ${CI_REGISTRY_IMAGE}:latest

is completly ignored and just some random image name containing a hashes is generated. This block the usage of gitlab-ci, since the resulting image is not pushable to the gitlab registry, since the naming of the docker image does not correspond anymore correctly to the project name. Nevertheless a workaround is at the moment to create a dummy Dockerfile just containing the FROM statement referencing the image name.

But it would be beneficial if the --image-name works for both scenarios ;)

best,
Christian

invasy added a commit to invasy/devcontainers-cli that referenced this issue Jul 5, 2023
- Method `extendImage` created image with the default name ignoring
  `--image-name` option.
- The image could not be tagged after building, because CLI exited
  with `ERROR: denied: requested access to the resource is denied`
  after pushing attempt.
- Added image names from `--image-names` option at building stage.
@jacobwoffenden
Copy link

Running into same issue, frustrating as it's actually in the example-usage as well https://github.com/devcontainers/cli/tree/main/example-usage#building-an-image-from-devcontainerjson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants