Skip to content
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

Change command to reset build context #1005

Closed
wants to merge 1 commit into from

Conversation

misilot
Copy link

@misilot misilot commented Feb 20, 2024

When I tried to run the specified command, docker told me to run docker context use default

@regisb
Copy link
Contributor

regisb commented Feb 21, 2024

What's the full error message you got?

@misilot
Copy link
Author

misilot commented Feb 21, 2024

(.venv) ➜ tutor-nla-theme git:(nla-v17) ✗ docker buildx use default
ERROR: run docker context use default to switch to default context
(.venv) ➜ tutor-nla-theme git:(nla-v17) ✗ docker context use default
default
Current context is now "default"

@regisb
Copy link
Contributor

regisb commented Feb 22, 2024

What's your Docker version?

@misilot
Copy link
Author

misilot commented Feb 22, 2024

What's your Docker version?

Docker version 25.0.3, build 4debf41

@regisb
Copy link
Contributor

regisb commented Feb 27, 2024

That's strange. The docker buildx use command is not deprecated in Docker 25.0.3, as far as I know: https://github.com/docker/buildx/blob/master/docs/reference/buildx_use.md
https://docs.docker.com/engine/release-notes/25.0/
https://docs.docker.com/build/release-notes/

I can't reproduce the issue on my machine. I'm running Docker 25.0.3 as well, with docker buildx version==v0.12.1. I'm wondering if you have a "default" builder at all? You can check with:

docker buildx ls

@DawoudSheraz DawoudSheraz self-assigned this Mar 12, 2024
@DawoudSheraz
Copy link
Contributor

While there are some issues with 'default' instance on my system, I am also seeing the mentioned error. I am also using Docker 25.0.3, on Mac.

> docker buildx ls           
NAME/NODE       DRIVER/ENDPOINT  STATUS   BUILDKIT PLATFORMS
dawoudsheraz    docker-container                   
  dawoudsheraz0 desktop-linux    inactive          
default *                        error             
desktop-linux   docker                             
  desktop-linux desktop-linux    running  v0.12.5  linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

Cannot load builder default *: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

> docker buildx use desktop-linux
ERROR: run `docker context use desktop-linux` to switch to context desktop-linux

> docker context use desktop-linux
desktop-linux
Current context is now "desktop-linux"

@regisb
Copy link
Contributor

regisb commented Mar 26, 2024

@misilot do you run macOS?

EDIT: given that the command still exists I don't understand why it would report to use docker context use instead.

@misilot
Copy link
Author

misilot commented Mar 26, 2024

@regisb, yes I am running macOS

@regisb
Copy link
Contributor

regisb commented Mar 27, 2024

What's the output of docker buildx ls?

@misilot
Copy link
Author

misilot commented Mar 27, 2024

What's the output of docker buildx ls?

NAME/NODE       DRIVER/ENDPOINT             STATUS   BUILDKIT PLATFORMS
default         docker
  default       default                     running  v0.12.5  linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
desktop-linux * docker
  desktop-linux desktop-linux               running  v0.12.5  linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

@DawoudSheraz DawoudSheraz removed their assignment Apr 9, 2024
@hamza-56
Copy link

The command docker buildx use still exists. However, to revert to the default context, we need to use the context command. When switching to a non-default context, we can utilize buildx.

https://github.com/docker/buildx/pull/39/files

@DawoudSheraz
Copy link
Contributor

The command docker buildx use still exists. However, to revert to the default context, we need to use the context command. When switching to a non-default context, we can utilize buildx.

https://github.com/docker/buildx/pull/39/files

Right. I think we can make the docs explicit that we need to use docker context use default specifically to switch back to default but can use buildx to switch to non-default contexts.

@regisb
Copy link
Contributor

regisb commented Apr 16, 2024

Builders and contexts are different things, so don't think that we should be recommending to switch context by default.

I just saw this part of the docker buildx use documentation:

Alternatively, a context name can be used to switch to the default builder of that context.

If I understand correctly, docker buildx will first check if the argument corresponds to a different context name. Thus, I am able to reproduce the issue by switching to a different context, first:

$ docker context create pouac --docker from=default
pouac
Successfully created context "pouac"
{09:25:40:caffeine}~$ docker context ls
NAME        DESCRIPTION                               DOCKER ENDPOINT               ERROR
default *   Current DOCKER_HOST based configuration   unix:///var/run/docker.sock   
pouac                                                 unix:///var/run/docker.sock   
$ docker context use pouac
pouac
Current context is now "pouac"
$ docker buildx use max4cpu
$ docker buildx use default
ERROR: run `docker context use default` to switch to default context

@misilot what is the output of docker context ls for you?

@misilot
Copy link
Author

misilot commented Apr 16, 2024

➜  ~ 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/tmisilo/.docker/run/docker.sock

Is what I have currently on my laptop (macos)

When I tried to run the specified command, docker told me to run `docker context use default`
@regisb
Copy link
Contributor

regisb commented Apr 16, 2024

This confirms my assumption. Docker recommends that you run docker context use instead of docker buildx use when you have a custom context that you are currently using. As a consequence, I don't think that docker context use should be the general recommendation.

@misilot
Copy link
Author

misilot commented Apr 16, 2024

Sounds good. I'll go with Docker is just creating custom contexts on it's own since I believe those are the default from an install :)

@DawoudSheraz
Copy link
Contributor

Based on the conversations above, it seems no further action is required. Closing this out. Feel free to re-open/open a new one if some changes in docs are still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Won't fix
Development

Successfully merging this pull request may close these issues.

None yet

4 participants