August 2019
Beginner to intermediate
798 pages
17h 2m
English
If you work with Docker, you will find this section particularly handy as it will teach you how to communicate with Docker using Go and the Docker API.
The dockerAPI.go utility, which will be presented in four parts, implements the docker ps and the docker image ls commands. The first command lists all running containers, whereas the second command lists all available images on the local machine.
The first part of dockerAPI.go is as follows:
package main
import (
"fmt"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
As dockerAPI.go requires lots of external packages, it would be a good idea to execute it using Go modules; therefore, execute export GO111MODULE=on before ...
Read now
Unlock full access