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
- Creating a compatible runtime as a Docker image or Converting an existing runtime to a Docker image
- Loading your Docker Image
- Tagging your Docker image
- Pushing your Docker image to a repository
Creating a compatible runtime
- Create a Python project for Linux on the ActiveState Platform.
- Add any packages you may need for your project, or click Finish and Install Python.
- To enable the Docker image option, go to the Configuration tab of your project page and click Change in the “Platforms” section.
- Check the Linux Glibc 2.28 and Docker boxes.
![Docker options on language selection page alt_text](docker.png)
- Click Close to save your selection.
- Click Save Changes and Start Build to begin the build process for your project.
- When your project build has completed, go to the Download Builds tab of your project page and click the Install via Docker tab.
![download Docker in Download Builds tab alt_text](download-docker.png)
- 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
- From the Configuration tab of your project page, make sure the language set for your project is Python 3.8 or later.
- In the “Platforms” section on your Configuration tab, click Change.
- Check the Linux Glibc 2.28 and Docker boxes.
![Docker options on language selection page alt_text](docker.png)
- Click Close to save your selection.
- Click Save Changes and start Build to begin the build process for your project.
- When your project build has completed, go to the Download Builds tab of your project page and click the Install via Docker tab.
![download Docker in Download Builds tab alt_text](download-docker.png)
- 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.
![commands on Download Builds tab alt_text](commands.png)
- Open a command terminal and go to the directory containing the
.tar
file you downloaded from ActiveState. - 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
- 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
- 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.