Install Docker Buildx
-
Download the Buildx binary:
mkdir -p ~/.docker/cli-plugins curl -SL https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx
-
Make it executable:
chmod +x ~/.docker/cli-plugins/docker-buildx
-
Verify the installation:
docker buildx version
Uninstall Docker Buildx
-
Remove the Buildx Binary:
rm ~/.docker/cli-plugins/docker-buildx
-
Verify the Uninstallation:
docker buildx version
Working with Buildx Builder
-
Create a new builder instance:
docker buildx create --name mybuilder docker buildx use mybuilder
-
Inspect and bootstrap the builder:
docker buildx inspect --bootstrap
-
Build your Docker image using Buildx:
docker buildx build -t example:v1 .
-
Switch back to the default builder:
docker buildx use default
-
Remove the custom builder instance (optional, if you no longer need it):
docker buildx rm mybuilder
-
How to Load the Built Image
docker buildx build --tag example:v1 --load .
-
How to Push the Built Image
docker buildx build --tag your-dockerhub-username/example:v1 --push .