Versions Compared

Key

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

...

  • Install the Python® SDK as available from https://github.com/docker/docker-py

    Code Block
    languagebash
    titleInstall docker-py plugin
    pip install docker


    • Explanation:
      • Python® has to be available on the machine that the JS7 Agent is operated for. This includes Agents operated on premises and with Docker® containers.
      • This is just an example, there are more ways of installing the Python® SDK for Docker®.

  • Create a workflow with a shell job that imports the Python® SDK like this:

    Code Block
    languagebash
    titleImport docker-py plugin with Agents operated for Unix
    #!/usr/bin/python
    
    import docker
    
    client = docker.from_env()
    ...
    Code Block
    languagebash
    titleImport docker-py plugin with Agents operated for Windows
    @@findstr/v "^@@f.*&" "%~f0"|python.exe -&goto:eof
    
    import docker
    
    client = docker.from_env()
    ...


    Explanation
    :

  • Create JS7 - Job Resources for your containers.
    • Best practice is to use a Job Resource per container.
    • This allows specification of any properties of a container such as image name, host name, container name, mounts etc. from variables of a Job Resource.

...

  • The job script uses a number of parameters as it maps all options used to run a JS7 Agent from a Docker® container as explained in the JS7 - Agent Installation for Containers article.
  • The relevant part is the client.containers.run() function which is parameterized with frequently used options for specifying the image name, hostname, network name etc.
  • Environment variables are available from the assigned Job Resource.
  • The optional part includes displaying log output created on start-up of the container using the container.logs() function.

...