New Training: Automate Docker Engine with Python and Docker-py
In this 7-video skill, CBT Nuggets trainer Trevor Sullivan uses the docker-py community module for Python to automate many container tasks using an object-oriented approach. Watch this new DevOps training.
Learn DevOps with one of these courses:
This training includes:
- 7 videos
- 1.1 hours of training
You’ll learn these topics in this skill:
- Understanding Docker Engine Automation with Python
- Setting Up Your Docker-Python Development Tools on AWS
- Connect to the Docker Engine with Python
- Pull Container Images with Docker and Python
- Run Containers with Docker Engine and Python
- Build Custom Container Images with Docker and Python
- Update Existing Container Configuration with Docker and Python
How to Use Python to Manage Docker Containers
Docker is a great container tool for creating isolated apps. It is used for all sorts of things, especially in the cloud environment. So, it could be useful to automate the management of Docker containers. That is possible with Python, one of the most popular scripting languages used for automation, with a library called docker-py.
Docker-py is an open-source, freely available library for managing Docker within Python. It can be used for running and managing containers or swarms. Docker-py is essentially a wrapper for Docker, so it has the same functions as the native Docker command.
Getting started with Docker-py is simple. Use Python's native package manager called pip to install it. Docker-py is registered in pip simply as 'docker', so use the command 'pip install docker' to install docker-py. Likewise, if you connect to Docker using TLS, add the TLS option to the install command (pip install docker[tls]).
For more information about docker-py, read its documentation in its knowledge base.