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
feature request: make it possible to set the WORKDIR #1260
Comments
I've put together a draft PR which I think might resolve this, but I'm not familiar with the codebase and how best to test it end-to-end, so I'm likely to have missed something. Just to be clear, I would like a review on the PR, around what I'd need to do to get the feature included. But I'd also be happy if someone that knows the product better threw what I'd done away, and implemented it themselves. 😁 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the "migrating from dockerfile" example, the base
Dockerfile
uses theWORKDIR
statement https://docs.docker.com/reference/dockerfile/#workdirHowever, I don't see a way to set the workdir in the configuration at
ko/pkg/commands/options/build.go
Lines 91 to 172 in 7067ad2
As such, the workdir isn't set, e.g.
docker image inspect -f '{{.Config.WorkingDir}}' something_made_with_ko:latest
will return nothing.ko
inherits Docker config from a base container, but the default working directory of a Docker container is/
, and if it's not set in the base, it will still default to/
.Docker containers that are designed to process data have a location where you'd expect to mount in a volume, e.g.
/data
. Without being able to set the detfaultworkingdir
, you have to add an extra-w
parameter to set it on each use.docker run -w=/data -v `pwd`:/data container_name:latest
Whereas, with the workingdir set, you could do:
docker run -v `pwd`:/data container_name:latest
So, adding the ability to set the
workingdir
would be useful.The text was updated successfully, but these errors were encountered: