Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are a number of ways how to write a run command, find the following example:

  • Before starting the container consider to create a Docker volume to persistently store configuration files in the live folder of the JobScheduler Master installation:

    • Code Block
      languagebash
      titleRun Command
      linenumberstrue
      #!/bin/sh
      
      IMAGE_NAME="master-1-13"
      
      docker volume create --name=$IMAGE_NAME
      
      ln -s /var/lib/docker/volumes/$IMAGE_NAME/_data/ ./live
      
      sudo chmod o+r /var/lib/docker
      sudo chmod o+rx /var/lib/docker/volumes
      sudo chown -R $USER:$USER /var/lib/docker/volumes/$IMAGE_NAME
    • Explanations
      • Create the Docker volume with an arbitrary name, e.g. the image name. 
      • Create a symlink live that points to the Docker volume
      • Adjust permissions to allow the current user to read/execute from docker volumes. Make the current user the owner of the newly created volume.
      • This configuration will expose the Master's live directory to the Docker volume and allows the current user to add/update/delete configuration files to the live folder.
  • A typical run command could look like this:

    Code Block
    languagebash
    titleRun Command
    linenumberstrue
    #!/bin/sh
    
    IMAGE_NAME="master-1-13"
    RUN_USER_ID="$(id -u $USER):$(id -g $USER)"
    
    mkdir -p /some/path/logs
    
    docker run -dit --rm --user=$RUN_USER_ID --hostname=$IMAGE_NAME --network=js --publish=50444:40444 --mount="type=volume,src=$IMAGE_NAME,dst=/var/sos-berlin.com/jobscheduler/testsuite/config/live" --volume=/some/path/logs:/var/log/sos-berlin.com/jobscheduler/testsuite:Z --name=$IMAGE_NAME $IMAGE_NAME
  • Explanations
    • Using a common network for JobScheduler components allows direct access to resources such as ports within the network.
    • The RUN_USER_ID variable is populated with the numeric ID of the account and the group that executes the run command. This value is assigned the --user option to inject the account information into the container (replacing the account specified with the USE jobscheduler instruction in the Dockerfile).
    • Port 40444 for access to JobScheduler Master by JOC Cockpit can optionally be mapped to some outside port. This is not required if a network is used.
    • Specify a logs directory to be created that is referenced with the --volume option to expose the log directory of the JobScheduler Master for reading. Consider that the testsuite sub-directory is created from the value of the JobScheduler ID that is specified with the installer response file. Avoid to modify log files in this directory and to add new files.
    • The --mount option is used in order to map a previously created Docker volume (assumed to be the value of the src= option) e.g. to the JobScheduler Master's live folder. This allows to read and to write job related files to this directory that will automatically be picked up by JobScheduler Master.

...