dagu icon indicating copy to clipboard operation
dagu copied to clipboard

Invalid example of docker executor with volumes

Open piotrwalkusz1 opened this issue 6 months ago • 0 comments

In documentation https://dagu.readthedocs.io/en/latest/yaml_format.html there is an example:

steps:
  - name: deno_hello_world
    executor:
      type: docker
      config:
        image: "denoland/deno:1.10.3"
        container:
          volumes:
            /app:/app:
          env:
            - FOO=BAR
        host:
          autoRemove: true
    command: run https://examples.deno.land/hello-world.ts

This is not the correct way of mounting directories. For example this spec:

steps:
  - name: test
    executor:
      type: docker
      config:
        image: "alpine"
        container:
          volumes:
            /app:/app:
    command: ls /

will create output:

{"status":"Pulling from library/alpine","id":"latest"}
{"status":"Already exists","progressDetail":{},"id":"690e87867337"}
{"status":"Digest: sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5"}
{"status":"Status: Downloaded newer image for alpine:latest"}
app:
bin
dev
etc
home
lib
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var

Notice the directory with the name "app:" (colon at the end).

Here is the correct spec:

steps:
  - name: test
    executor:
      type: docker
      config:
        image: "alpine"
        host:
          binds:
            - /app:/app
    command: ls /

with output:

{"status":"Pulling from library/alpine","id":"latest"}
{"status":"Digest: sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5"}
{"status":"Status: Image is up to date for alpine:latest"}
app
bin
dev
etc
home
lib
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var

Related topic: https://stackoverflow.com/questions/48470194/defining-a-mount-point-for-volumes-in-golang-docker-sdk

piotrwalkusz1 avatar Jul 30 '24 20:07 piotrwalkusz1