Docker Buildx

Install Docker Buildx

  1. 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
    
  2. Make it executable:

    chmod +x ~/.docker/cli-plugins/docker-buildx
    
  3. Verify the installation:

    docker buildx version
    

Uninstall Docker Buildx

  1. Remove the Buildx Binary:

    rm ~/.docker/cli-plugins/docker-buildx
    
  2. Verify the Uninstallation:

    docker buildx version
    

Working with Buildx Builder

  1. Create a new builder instance:

    docker buildx create --name mybuilder
    docker buildx use mybuilder
    
  2. Inspect and bootstrap the builder:

    docker buildx inspect --bootstrap
    
  3. Build your Docker image using Buildx:

    docker buildx build -t example:v1 .
    
  4. Switch back to the default builder:

    docker buildx use default
    
  5. Remove the custom builder instance (optional, if you no longer need it):

    docker buildx rm mybuilder
    
  6. How to Load the Built Image

    docker buildx build --tag example:v1 --load .
    
  7. How to Push the Built Image

    docker buildx build --tag your-dockerhub-username/example:v1 --push .
    
Updated on