-
Notifications
You must be signed in to change notification settings - Fork 269
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
Dockerfile missing? #77
Comments
Hi @bherbruck 👋 Recently, we have modified the "Add devcontainer configuration files" command to make it more simpler and easier to understand. We have updated the Templates and built the dev container config using Features (which avoids the need of We still have few Templates which consist of a Dockerfile (eg. cpp, anaconda)
No, it's more of a design change 😄 ℹ️ Look how the |
Thanks for the explanation @samruddhikhandale! Is there any documentation for installing packages with |
You could take advantage of postCreateCommand to install packages. Eg. -
|
Creating your own Feature and sharing it with the community is a great thing to do, we highly appreciate that. You may want to look at currently available features here. |
Just to clarify, Dockerfiles are still fully supported. It's just more an an advanced use case, and we don't want people to have to be Docker experts in order to start using Devcontainers. We believe that devcontainer features make it easier for people to add and maintain functionality in their configuration and encourage the use of features as a starting point. But if you have a scenario that needs more flexibility/control, you can certainly add a Dockerfile. |
These docs will be helpful if you'd like to augment our existing templates with a Dockerfile. https://containers.dev/implementors/json_reference/#image-specific |
Thanks for all the clarification on this, is it possible to use local/relative "features" rather that importing from a public registry/repo? So if we wanted to do something like: "features": {
"./install-lots-of-packages-and-do-lots-of-stuff": {}
} |
Yes, it is possible. We have posted guidance in here - https://containers.dev/implementors/features-distribution/#addendum-locally-referenced |
FWIW - I would not recommend going to the trouble for basic things that you can do in a Dockerfile like doing apt-get install. All you need to do is switch
and add But - if you're going to reference a shell script in your Dockerfile anyway, a local feature is probably just as easy. That said - We flipped to using Perhaps this should be moved to the templates repo as a proposal to track upvotes? |
Can we get an option to add a dockerfile that exists on local? So if I had done |
@andreujuanc That would end up being specific to the Dev Containers extension I suspect since it would need access to your local machine and docker would have to be installed. But we could do that in concept - or we could just have an option to enter an image name as a starting point. I do think it would be pretty easy to automate the process of an |
No, now you want people to be "feature" expert, and remember names, find exactly the thing they want. Just yesterday a colleague asked me a favor to help him fix a piece of python code, I use devcontainers exclusively and I went ahead and created a python one. And whilst installing the dependencies I noticed I had to add Why was it so hard to keep the previous option whilst adding the new features on the side? Why the push towards "programming a json file", isnt better for everyone to understand how your dev environment work if they want? I know Dockerfiles are still available, but the wizard to create them was REALLY nice, and now I have to manually map things. But hey,maybe the top post's reactions might give a clue. Cheers |
@andreujuanc makes a lot of good points. When working in any higher-level language with C-bindings it is common to require external packages. Relying on a list of features can be handy if we need to run shell scripts during docker build, but for just installing packages... I too have spend considerable time trying to install a list of packages in my own features, doing it in a json string in the devcontainer.json file is not easily maintainable. Many already know docker. Adding another statement to |
Features are not portable and they are faraway less powerful than docker. My choice is done. |
More again, in a lot of company like the one I work for are using internal Debian/docker repository and have to manage network specific stuff that make feature almost totally unusable. |
I also forgot to mention that most of the time I reuse the same dockerfile for my devcontainers, my cicd, and my k8s. So that way I know that my app will run 100% of the time. |
If the goal is simple installation of packages, I think it easier to use Features for installing any package instead of writing a Dockerfile. For example, here is a Feature to install any package with It appears to be used as follows: Compare this to installing on a Dockerfile, which has the advantage of not having to worry about options like On the other hand, if the installation involves importing a gpg key instead of a simple installation like this, it may be more flexible to write it in a Dockerfile. (As a side note, the |
You think is easier, but consider someone who needs to search and find the correct feature for what they need.
I understand we are trying to abstract things out, but then we must not forget about the "advanced" use cases, which is what we are arguing here. We are not asking for the "features" to go away, but to at least have an option to rollback to the previous behaviour.
If you have 100 projects using that feature, it will have to be re-run in all containers, on the other side, if you have a dockerfile you just need to download it. Done. The problem here is that when a developer has a problem, it will have to search how to fix it with a feature, or, instead run a custom command, will will increase in size anyway with time. So just keeping the scripts within the dockerfile makes the most sense. Publishing docker images is also a thing, so people can reuse them within the org. |
Hi everyone! Thanks so much for the discussion and honest feedback so far, as this is incredibly helpful to shaping the dev container spec and its resources. I've opened an issue to discuss this topic and potential solutions: #135. Please feel free to share your thoughts there, we'd really appreciate any and all feedback. Thank you! |
It seems after
v0.16x.x
Dockerfile
s are no longer included in the.devcontainer
directory when using vscode's "Add devcontainer configuration files".These are critical for installing extra packages and customizing the development environment.
Is there some new functionality that deprecates this way of working with devcontainers?
The text was updated successfully, but these errors were encountered: