Creating Docker Images using the Platform

Currently, this functionality is restricted to images meant for integration with Cloudera. For general information about Docker containers click here.

With the ActiveState Platform, you can easily embed your Python runtime into a Docker image. To guarantee your image is built successfully, ensure that your project uses Python 3.8 or later.

The following will walk you through

  1. Creating a compatible runtime as a Docker image or Converting an existing runtime to a Docker image
  2. Loading your Docker Image
  3. Tagging your Docker image
  4. Pushing your Docker image to a repository

Creating a compatible runtime

  1. Create a Python project for Linux on the ActiveState Platform.
  2. Add any packages you may need for your project, or click Finish and Install Python.
  3. To enable the Docker image option, go to the Configuration tab of your project page and click Change in the “Platforms” section.
  4. Check the Linux Glibc 2.28 and Docker boxes.

alt_text

  1. Click Close to save your selection.
  2. Click Save Changes and Start Build to begin the build process for your project.
  3. When your project build has completed, go to the Download Builds tab of your project page and click the Install via Docker tab.

alt_text

  1. Click Download Docker Image to save it as a .tar file on your machine.

Convert an existing runtime to a Docker image

To convert an existing Python project

  1. From the Configuration tab of your project page, make sure the language set for your project is Python 3.8 or later.
  2. In the “Platforms” section on your Configuration tab, click Change.
  3. Check the Linux Glibc 2.28 and Docker boxes.

alt_text

  1. Click Close to save your selection.
  2. Click Save Changes and start Build to begin the build process for your project.
  3. When your project build has completed, go to the Download Builds tab of your project page and click the Install via Docker tab.

alt_text

  1. Click Download Docker Image to save it as a .tar file on your machine.

Loading your Docker image

Ensure that your client system has the Docker engine installed and running. After confirming Docker Engine on your machine you will need to

  • Load your newly created image into Docker
  • Tag it appropriately, and
  • Push the image to your registry.

alt_text

  1. Open a command terminal and go to the directory containing the .tar file you downloaded from ActiveState.
  2. Copy and paste the first command from the Download Builds > Install via Docker section of the page and paste it into your command line. The format should be similar to what’s shown below.
docker load -i orgname-projectname-docker-commitid.tar

Tagging your Docker image

  1. Copy and paste the second command from the Download Builds > Install via Docker section of the page and paste it into your command line. The format should be similar to what’s shown below.
docker tag orgname-projectname:commitid <your-registry-name>/orgname-projectname:commitid
  1. Replace with details provided by your Docker registry provider. For example, if you are using Docker Hub enter your Docker Hub username here.

Different private registry providers require different information for the registry name. Check with your provider to see what is needed to satisfy their requirements. Common elements may include the following

  • Host name
  • Port
  • Namespace/username

Pushing your Docker image to a repository

Copy and paste the third command from the Download Builds > Install via Docker section of the page and paste it into your command line. The format should be similar to what’s shown below. Replace your registry name with the same registry used above.

docker push <your-registryepository-name>/:<tag>orgname-projectname:commitid

The Docker image of your project has been successfully tagged and pushed to a registry.

Troubleshooting

  • An error to build may be the result of the selected language version of your project. Only projects with a language version of Python 3.8 or later are compatible. Check here for information on how to change the language version of your project.

  • If you do not see the option for a Docker deployment method for your project, make sure that Linux Glibc 2.28 is a selected operating system for your project.

  • If you have trouble pushing your Docker image to a repository, check the formatting specifications for your registry as listed by your Docker registry provider. Different providers will list different specifications for the format of the registry names.