- Let's begin by installing the docker package for python using pip3:
$ sudo pip3 install docker
- Now, let's launch python3 and import the docker and json packages, as demonstrated in the following:
- Having imported the docker and json packages, let's connect to the Docker daemon through the Unix socket, unix://var/run/docker.sock, using docker.DockerClient, as shown here:
Here, base_url is the Docker daemon's connection address.
- Continue on to print the Docker daemon version using the following code:
Here, the client.version() ...