#Issue with pushing newly created image

1 messages · Page 1 of 1 (latest)

fast pier
#

My attempt to build a new image and push it to Docker hub does not seem to have any effect - all of the steps in my install script do not seem to have taken place. Can anyone tell me what is wrong? My script like so:

image: {
  pull: docker.#Pull & {
    source: "ubuntu"
  }
  install: bash.#Run & {
    input: pull.output
    script: contents: """
      apt -q update
      apt install -yqq wget    
    """
  }
  push: docker.#Push & {
    auth: {
      username: "USERNAME"
     secret: client.env.DOCKER_PASSWORD
    }
    dest: "repo/image_name:version"
    image: install.output
  }
}
primal otter
#

👋 Hi @fast pier Do you have a full Dagger Plan? like this?

package main

import (
  "dagger.io/dagger"
  "universe.dagger.io/bash"
  "universe.dagger.io/docker"
)

dagger.#Plan & {

  client: env: DOCKER_PASSWORD: dagger.#Secret

  actions: {
    image: {
      pull: docker.#Pull & {
        source: "ubuntu"
      }
      install: bash.#Run & {
        input: pull.output
        script: contents: """
            apt -q update
            apt install -yqq wget    
          """
      }
      push: docker.#Push & {
        auth: {
          username: "jeremyatdockerhub"
          secret:   client.env.DOCKER_PASSWORD
        }
        dest:  "jeremyatdockerhub/ubuntu_test:latest"
        image: install.output
      }
    }
  }
}
#

worked for me

fast pier
#

Yes, I have a complete plan

#

It does push, the issue is that if I reference that image in subsequent steps, it does not contain any of the changes I made to it

#

I believe the answer is I need to do a "forcePull" when I reference that image in a subsequent step

#

Alternatively, what I really want to do is commit an image locally, that I can reference in other steps

primal otter
# fast pier It does push, the issue is that if I reference that image in subsequent steps, i...

Ah, okay. So the pushed image does contain your changes, but you're having issues using that image in subsequent action steps. Let me try:

jpkbst ➤ docker run -it --rm ubuntu wget
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "wget": executable file not found in $PATH: unknown.
jpkbst ➤ docker run -it --rm jeremyatdockerhub/ubuntu_test:latest wget
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.
#

how's this?

package main

import (
  "dagger.io/dagger"
  "universe.dagger.io/bash"
  "universe.dagger.io/docker"
)

dagger.#Plan & {

  client: env: DOCKER_PASSWORD: dagger.#Secret

  actions: {
    image: {
      pull: docker.#Pull & {
        source: "ubuntu"
      }
      install: bash.#Run & {
        input: pull.output
        script: contents: """
            apt -q update
            apt install -yqq wget    
          """
      }
      push: docker.#Push & {
        auth: {
          username: "jeremyatdockerhub"
          secret:   client.env.DOCKER_PASSWORD
        }
        dest:  "jeremyatdockerhub/ubuntu_test:latest"
        image: install.output
      }
    }
    test: docker.#Run & {
      input: image.install.output
      command: {
        name: "wget"
        args: ["--version"]
      }
      always: true
    }
  }
}
#

image action has subactions of install and push.
test action uses the image created in image.install

#

dagger do test --log-format plain