Ines
Ines

Reputation: 1

Couldn't find the image pushed in dockerhub using buildkit and argo workflow

I'm trying to build and push a docker image from a dockerfile to my private repo in dockerhub using buildctl-daemonless.sh command using argo workflow, the following is the step in the workflow that does the job. The problem is that I get that it runs successfully but I couldn't find the image pushed

- name: image
      inputs:
        parameters:
          - name: path
          - name: image
      volumes:
        - name: test-secret-secret
          secret:
            secretName: test-secret-secret
      container:
        readinessProbe:
          exec:
            command: [ sh, -c, "buildctl debug workers" ]
        image: moby/buildkit:v0.9.3-rootless
        volumeMounts:
          - name: work
            mountPath: /work
          - name: test-secret-secret
            mountPath: /.docker
        workingDir: /work/{{inputs.parameters.path}}
        env:
          - name: BUILDKITD_FLAGS
            value: --oci-worker-no-process-sandbox
          - name: DOCKER_CONFIG
            value: /.docker
        command: [ sh, -c, "buildctl-daemonless.sh" ]
        args:
          - build
          - --frontend=dockerfile.v0
          - --local context=.
          - --local dockerfile=.
          - --output type=image,name=docker.io/myusername/repo-test:argoworkflow,push=true

The only thing I get from the logs is this

time="2024-03-31T11:30:27 UTC" level=info msg="capturing logs" argo=true
NAME:
   buildctl - build utility
USAGE:
   buildctl [global options] command [command options] [arguments...]
VERSION:
   v0.9.3
COMMANDS:
   du        disk usage
   prune     clean up build cache
   build, b  build
   debug     debug utilities
   help, h   Shows a list of commands or help for one command
GLOBAL OPTIONS:
   --debug                enable debug output in logs
   --addr value           buildkitd address (default: "unix:///run/user/1000/buildkit/buildkitd.sock")
   --tlsservername value  buildkitd server name for certificate validation
   --tlscacert value      CA certificate for validation
   --tlscert value        client certificate
   --tlskey value         client key
   --tlsdir value         directory containing CA certificate, client certificate, and client key
   --timeout value        timeout backend connection after value seconds (default: 5)
   --help, -h             show help
   --version, -v          print the version

Any thoughts please what could be the problem

Upvotes: 0

Views: 56

Answers (1)

wesley scholl
wesley scholl

Reputation: 29

Here is the official Argo Workflows Buildkit example configuration:

Ensure that test-secret-secret contains the following:

{"auths":
  {"https://index.docker.io/v1/":
    {"auth": "$DOCKER_USERNAME:$DOCKER_TOKEN" # Base64 encoded
    }
  }
}

Docker Configuration

  • Access Token for Docker Hub: Generate a personal access token at https://hub.docker.com/settings/security to publish Docker images.

  • Secret Creation:

    • Shell, bash or zsh: Add the following to your shell profile (e.g. ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.profile).
    export DOCKER_USERNAME=******
    export DOCKER_TOKEN=******
    
    • Kubernetes Secret Creation: Add -n <namespace> for specific namespaces.
    kubectl create secret generic docker-config --from-literal="config.json={\"auths\": {\"https://index.docker.io/v1/\": {\"auth\": \"$(echo -n $DOCKER_USERNAME:$DOCKER_TOKEN|base64)\"}}}"
    

I recently authored a CI workflow example that uses Buildkit successfully. For further reference:

Upvotes: 0

Related Questions