Docker : dial tcp 127.0.0.1:8091: getsockopt: connection refused

1down votefavorite

I am trying to upload the json to a local couchbase server in docker.

For that, I am using the below-mentioned content in docker file

From couchbase

ADD lines2.json /

WORKDIR opt/couchbase/bin

RUN echo "PWD  "$PWD


CMD ["cbimport", "json", "-u", "Administrator", "-p", "password", "-b", "sample", "-c", "couchbase://localhost", "-f", "lines", "-d", "file:///lines2.json", "-g", "key::%name%", "-t", "4"] 

Getting the error as:

Json import failed: Rest client error (GET http://localhost:8091/pools): dial tcp 127.0.0.1:8091: getsockopt: connection refused

Please help me out on solving the issue

Thanks

i haven’t seen the use of CMD like yours, try use ENTRYPOINT and CMD.
Combining ENTRYPOINT and CMD allows you to specify the default executable for your image while also providing default arguments to that executable which may be overridden by the user. Let’s look at an example:

FROM ubuntu:trusty
ENTRYPOINT ["/bin/ping","-c","3"]
CMD ["localhost"]

i appreciate your response. In your response CMD localhost is argument for ENTRYPOINT bing/ping, but in my code, i have given the both command and arguments in one line statement.