Skip to content

Connection test not successful when using Docker socket #28

Closed

Description

@DecaTec

Local installation on the same machine where Nextcloud is also running.

Command to run the Docker container:

docker run -e NC_HAPROXY_PASSWORD="some_secure_password" \
  -v /var/run/docker.sock:/var/run/docker.sock \
  --name nextcloud-appapi-dsp -h nextcloud-appapi-dsp \
  --restart unless-stopped --privileged -d ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release

These are the information while registering the Deploy Daemon:
image

I would have expected that under "Daemon host", /var/run/docker.sock should be the correct option (as indicated by the text below the input field).

Testing the connection then fails.

Error message in the NC log:

"Could not connect to Docker daemon", ... ,"exception":{"Exception":"Guzzle
Http\\Exception\\ConnectException","Message":"cURL error 7: Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server (see 
https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost/v1.41/_ping" ...

So it tries to connect to localhost instead of using the Docker socket.


My workaround for now is using an additional parameter (-p) when starting the container in order to map the local port to the container's port:

docker run -e NC_HAPROXY_PASSWORD="some_secure_password" \
  -p 127.0.0.1:2375:2375 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  --name nextcloud-appapi-dsp -h nextcloud-appapi-dsp \
  --restart unless-stopped --privileged -d ghcr.io/cloud-py-api/nextcloud-appapi-dsp:release

When adding a Deploy Daemon, under "Daemon host" I've set localhost:2375 and the connection test was successful.

So my questions now are:

  • Should I be able to connect via /var/run/docker.sock
  • Is adding the parameter -p the correct way to deal with this problem?
  • Is this just missing in the documentation or am I missing something?

Thanks in advance!

Activity

  1. bigcat88 commented on Jun 14, 2024

    @bigcat88
    Member

    Looks like it is misleading UI. It should mean:

    nextcloud-appapi-dsp:2375 OR /var/run/docker.sock

    DockerSocketProxy is only needed when nextcloud-appapi-dsp:2375 is placed in "Host"

    Can you try remove the "/var/run/docker.sock" and place nextcloud-appapi-dsp:2375 in UI and also change Network to something like non-default docker bridge network

  2. DecaTec commented on Jun 14, 2024

    @DecaTec
    Author

    Thanks for the quick reply!

    Changed "Deamon host" to nextcloud-appapi-dsp:2375 and "Network" to bridge.
    Connection test fails one again. Error in NC Logs: Could not resolve host: nextcloud-appapi-dsp

    Should a separate Docker network be created? Wouldn't this be more complicated compared to using the -p parameter?

  3. bigcat88 commented on Jun 14, 2024

    @bigcat88
    Member

    Does Nextcloud is running inside docker container or host? I guess it running in host?

  4. DecaTec commented on Jun 14, 2024

    @DecaTec
    Author

    Yes, directly installed on host.

  5. bigcat88 commented on Jun 14, 2024

    @bigcat88
    Member

    https://cloud-py-api.github.io/app_api/DeployConfigurations.html#nc-docker-on-the-same-host

    I 'm suggesting going to "Suggested config values(template Docker Socket Proxy):" and try option A or B

  6. DecaTec commented on Jun 14, 2024

    @DecaTec
    Author

    OK, I've used option B, which is essentially the same as suggested in my first post (aside from setting bridge as network when configuring daemon).

    One last thing: The documentation that when using one of your suggested options, the HaProxy password may be empty. This was not the case for me, I always have to specify a password here (even if NC_HAPROXY_PASSWORD was omitted when starting the container).

    Thanks for your help. This issue may be closed.

  7. bigcat88 commented on Jun 14, 2024

    @bigcat88
    Member

    Glad that it works.

    One last thing: The documentation that when using one of your suggested options, the HaProxy password may be empty. This was not the case for me, I always have to specify a password here (even if NC_HAPROXY_PASSWORD was omitted when starting the container).

    Thank you for pointing on this, I will keep issue open - until check this, maybe for the last version there can not be empty password - and I should fix that.

      if [ -n "$NC_HAPROXY_PASSWORD_FILE" ]; then
        NC_HAPROXY_PASSWORD=$(mkpasswd -m sha-256 < "$NC_HAPROXY_PASSWORD_FILE")
      else
        NC_HAPROXY_PASSWORD=$(echo "$NC_HAPROXY_PASSWORD" | mkpasswd -m sha-256)
      fi
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions