mirror of
https://github.com/umputun/reproxy.git
synced 2024-11-24 08:12:31 +02:00
Set minimal supported docker version
This commit is contained in:
parent
f43e9092df
commit
813ed6df3d
@ -313,9 +313,11 @@ func NewDockerClient(host, network string) DockerClient {
|
||||
}
|
||||
|
||||
func (d *dockerClient) ListContainers() ([]containerInfo, error) {
|
||||
// const APIVersion = "v1.41"
|
||||
// resp, err := d.client.Get(fmt.Sprintf("http://localhost/%s/containers/json", APIVersion))
|
||||
resp, err := d.client.Get("http://localhost/containers/json")
|
||||
// Minimum API version that returns attached networks
|
||||
// docs.docker.com/engine/api/version-history/#v122-api-changes
|
||||
const APIVersion = "v1.22"
|
||||
|
||||
resp, err := d.client.Get(fmt.Sprintf("http://localhost/%s/containers/json", APIVersion))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed connection to docker socket: %w", err)
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ func TestDocker_refresh(t *testing.T) {
|
||||
|
||||
func TestDockerClient(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
require.Equal(t, "/containers/json", r.URL.Path)
|
||||
require.Equal(t, `/v1.22/containers/json`, r.URL.Path)
|
||||
|
||||
// obtained using curl --unix-socket /var/run/docker.sock http://localhost/v1.41/containers/json
|
||||
resp, err := ioutil.ReadFile("testdata/containers.json")
|
||||
|
Loading…
Reference in New Issue
Block a user