(bug): context not set for using docker-desktop
Closed this issue · 5 comments
Describe the bug
When Porter tries to interact with Docker we get an error about the docker context needing to be set to default - if we are docker desktop users our context by default will be on docker-linux not default.
docker context ls
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default moby Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux * moby Docker Desktop unix:///Users/*****/.docker/run/docker.sock
Expected behavior
Users should not have to switch their docker context
when using Porter. We should grab the current context during runtime. I think this is due to something being hardcoded in CNAB and how it is using docker, but I'm not sure.
I think it's related to something here
Hello :)
i'm interested to try to fix this issue, can you assign me the issue if it's not already taken @schristoff ?
Hi @SoniaisMad, are you currently working on this?
I was trying to reproduce the problem, I've both Docker CE and Docker Desktop in my Ubuntu and it seems that when we run porter build
we got this error saying that we need to switch to the default context.
I've made some tests and it seems that just getting the current context from the users Docker solves the problem, I don´t know if I'm missing something, can you help me? @schristoff
bldr, err := builder.New(cli,
builder.WithName(cli.CurrentContext()), --> I've changed this from "default" to the "current context"
builder.WithContextPathHash(b.Getwd()),
)
@HeavyBR Go ahead, i haven't started to work on this, so feel free to submit a PR.
Ran into this and submitted a potential fix. ^