Using Artifact Stanza to Copy Files into Docker Container

I have followed this hint:

the result is a directory:

/ # cd /usr/share/
/usr/share # ls -la
total 8
~
drwxr-xr-x 2 root root 4096 Mar 17 07:52 ojdbc8.jar
~

I am on nomad 1.2.6. Any suggestion?

Hi @michimau. Thanks for using Nomad.

Can you post your jobspec? Also, if you look at <nomad data_dir>/alloc/<alloc_id>/<task_name>/local do you see the ojdbc8.jar file?

job "gis2citus" {
  datacenters = ["dc1"]
  type = "batch"
  parameterized {
    meta_required = ["customer_name","customer_email"]
    meta_optional = ["rep_name","rep_email","rep_title","product_name"]
  }
  meta {
    rep_name = "BabbageCorp"
    rep_email = "hello@mechanicalcomputing.com"
  }
  group "importer" {
    task "output" {
      driver = "docker"

      config {
        image = "osgeo/gdal:alpine-small-3.4.2"
        command = "sh"
        args = ["-c","sleep 1000000"]
        volumes = ["local/ojdbc8.jar:/usr/share/ojdbc8.jar"]
      }
      artifact {
        source = "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/19.6.0.0/ojdbc8-19.6.0.0.jar"
        destination = "local/ojdbc8.jar"
        mode = "file"
      }
    }
  }
}

i can see /usr/share/ojdbc8.jar, but if you ls -la, you’ll notice like a directory is created.

I start nomad and consul in docker-compose.

snip

  nomad-server:
    image: eeacms/nomad:1.2.6
    container_name: nomad-server
    restart: always
    privileged: true
    ports:
      - '4649:4649'
      - '4647:4647'
      - '4648:4648'
      - '4646:4646'
    network_mode: "host"
    depends_on:
      - consul
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - nfsvolume:/opt
      - nomadd:/etc/nomad.d
    environment:
      DATADIR: "/tmp"
      DATACENTER: "dc1"
      ENCRYPTION_KEY: "somethingfunly"
      CONFIGDIR: "/opt/nomad/config/server"
    command:
      /bin/sh -c 'nomad agent -server -config=/etc/nomad.d/server.hcl -bootstrap-expect=1 -data-dir=$${DATADIR} -dc=$${DATACENTER} -encrypt=$${ENCRYPTION_KEY}'