You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnfmt.Errorf("could not create build config map: %w", err)
}
bo.BuildConfigs=buildConfigs
}
returnnil
}
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 detfault workingdir, 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:
a-h
linked a pull request
Mar 18, 2024
that will
close
this issue
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. 😁
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: