-
Notifications
You must be signed in to change notification settings - Fork 308
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
Remote containers: Support target of multi-stage Dockerfile, buildArgs #46
Comments
hi, as this ticket is referenced by another which requests buildArgs, i'd also vote for buildArgs. atm a remote container runs as root, so all files do belong to root and not the user i want. in your doc you mention a solution like this:
this helps to create a remote container which uses my UID/GID and so all files have the correct rights on the mounted filesystem. but as you see, the so it would be great to specify at the moment i use the docker-compose solution, because in a compose file one can reference environment values (and use these values as build-args for a dockerfile). but here i have other problems ... i'd personally would like to use a pure container solution instead of a compose file. |
@ulrichSchreiner What are the issues you see when using a docker-compose file? I have so far considered that an alternative for when the devcontainer.json does not support all the required options. |
@chrmarti i want my directory name to be the mountpoint on the remote container. when using a compose file with the mount option
the thing on the remote side is called perhaps i have a different look as you to remote containers. i see them as a clean-room environment, for specific types of project. so i would like to attach the at the momemt this works, by opening one project and than adding folders to the workspace (on the remote side). as i mount my $HOME to the container (but not as the HOME on the remote), this works. but i always have to reopen the workspace when i disconnect, because the connection is always initiated by a Open folder in remote container i think you see the but this is my personal opinion which is a little off-topic here i think ... |
@ulrichSchreiner Thanks for clarifying. (Related: #278) |
@chrmarti I think pretty much all commands should be extensible and also support environment variable injection otherwise it's so easy to run into a rabbit hole over small details like this. For my case docker compose might work and I'll give it a go but I would have preferred to stick to a simple container approached |
From @eedwards-sk #1857 I seem to be unable to specify build args during the dev container build process. https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg I want to perform an npm install during the build process, but this requires providing an environment variable for npm private registry authentication. a build arg would be the way to accomplish this (an env var) I would like a way to provide build args during the build process, from file (so e.g. an {
"name": "foo",
"context": "..",
"dockerFile": "Dockerfile",
"build_arg_file": "npmjs.env",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"dbaeumer.vscode-eslint"
]
} |
We also need to inject user/pass at container build time and |
@chrmarti how would you use |
Adding I wonder if we should place these together with |
So with all the build related properties it would make sense to group them in a top-level {
"build": {
"dockerFile": "...",
"context": "...",
"target": "...",
"args": {
"FOO": "BAR"
}
},
"preBuildCommand": "..."
} This clarifies their use while avoiding the
|
Renaming
|
I'm not sure I fully understand everything in this thread, but I was looking for a solution to this problem as well. When I create new files inside a devcontainer they all belong to |
@ajschmidt8 I assume you're on Linux. This works for single containers (not Docker Compose): Make sure your image has a regular user (non-root) and set |
It would be awesome if one could specify the
target
of a multi-stage Dockerfile to be used for developing. This makes it possible to have one Dockerfile which first creates the build-image and afterwards the runtime container. This central Dockerfile can either be used from the buildserver to create the final container or by VSCode with a target to build only the dev container.For example the following Dockerfile could be used to build the final container.
On the other hand vscode could use the
builder
target to build the development container:Furthermore this would make the adaption of projects to Dev-Containers especially smooth and easy...
The text was updated successfully, but these errors were encountered: