Skip to content

Error: "unexpected end of JSON input" from CreateNetwork() #845

@KIVagant

Description

@KIVagant

Hello. I'm getting the error from network.CreateNetwork():

unexpected end of JSON input

I feel like it is produced by the line:
https://github.com/fsouza/go-dockerclient/blob/main/network.go#L181

       if err := json.NewDecoder(resp.Body).Decode(&cnr); err != nil {
		return nil, err
	}

I see how the network is being created in Docker, but I cannot get the proper response back from the function.

It would be nice to have a debug mode to check the actual response.

Package Version:

github.com/fsouza/go-dockerclient v0.0.0-20170929173952-199e3d903f17

Docker version:

Docker Desktop Community, OSX, 2.3.0.5 (48029) stable
Engine: 19.03.12

Update: I found what caused this specific issue (or more how to fix it):

echo '{}' > ~/.dockercfg

Pretty funny that an empty ~/.dockercfg prevents the network from being created. Anyway it would be nice to get a message printed to stderr (at least in "debug" mode).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions