FAQ
My Dockerfile looks like this:

FROM golang:onbuild
RUN go get [...]
RUN apt-get update && apt-get install -y redis-server
CMD redis-server
CMD go run main.go

My program needs Redis server listening on the default port 6379 and I get
connection refused.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Rjeczalik at Apr 17, 2015 at 8:43 am

    On 17 April 2015 at 10:18, Rayland wrote:
    My program needs Redis server listening on the default port 6379 and I
    get connection refused.

    It's more about Docker than Go, but add "EXPOSE 6379" to your Dockerfile
    and use -P flag when running the container.

    https://docs.docker.com/reference/builder/#expose

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Rayland at Apr 17, 2015 at 8:50 am
    Why would I use EXPOSE when Redis is inside the same container as my
    program? I tried your way just to check and it doesn't work.
    On Friday, April 17, 2015 at 11:43:22 AM UTC+3, rjeczalik wrote:

    On 17 April 2015 at 10:18, Rayland <guian...@gmail.com <javascript:>>
    wrote:
    My program needs Redis server listening on the default port 6379 and I
    get connection refused.

    It's more about Docker than Go, but add "EXPOSE 6379" to your Dockerfile
    and use -P flag when running the container.

    https://docs.docker.com/reference/builder/#expose
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Rjeczalik at Apr 17, 2015 at 9:24 am

    On 17 April 2015 at 10:50, Rayland wrote:
    Why would I use EXPOSE when Redis is inside the same container as my
    program? I tried your way just to check and it doesn't work.

    I shot in the dark that you connect from outside. Now my bet is on redis
    server rejects your connection due to authentication issues.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Gijs at Apr 17, 2015 at 11:01 am
    Unless something has changed since I last experimented with Docker (which
    could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.
    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and I get
    connection refused.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Gijs Kunze at Apr 17, 2015 at 11:16 am
    This seems similar to your issue, so maybe supervisor can help you.

    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services
    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:

    Yes it seems you are right, but if I use RUN instead of CMD to start the
    Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the
    background for my app to use it.
    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:

    Unless something has changed since I last experimented with Docker (which
    could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and I
    get connection refused.

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Rayland at Apr 17, 2015 at 11:41 am
    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon <guian...@gmail.com
    <javascript:>> wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start the
    Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs <gwk...@gmail.com <javascript:>>
    wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and I
    get connection refused.

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Martin at Apr 17, 2015 at 11:51 am
    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church of
    1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a second
    one with your go application. If that doesn't work for you you simply need
    to go the supervisor route (or any process monitor of choice, thou I hear
    systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start the
    Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker (which
    could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and I
    get connection refused.

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Guianu Leon at Apr 17, 2015 at 11:57 am
    Yes I tried starting a container from the official Redis image and connect
    its default port to 6379 on host and then I started my app's container and
    I get connection refused. I then tried using --link and it still doesn't
    work. The Redis container works ok because I can use redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church
    of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a second
    one with your go application. If that doesn't work for you you simply need
    to go the supervisor route (or any process monitor of choice, thou I hear
    systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start the
    Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and
    I get connection refused.

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Egon at Apr 17, 2015 at 1:46 pm
    What does your golang code look like?
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and connect
    its default port to 6379 on host and then I started my app's container and
    I get connection refused. I then tried using --link and it still doesn't
    work. The Redis container works ok because I can use redis-cli to acces it.

    On Fri, Apr 17, 2015 at 2:51 PM, Martin <mar...@marcher.name <javascript:>
    wrote:
    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church
    of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin

    On Fri, Apr 17, 2015 at 1:42 PM Rayland <guian...@gmail.com <javascript:>>
    wrote:
    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start the
    Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and
    I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Yucong Sun at Apr 17, 2015 at 1:48 pm
    What you need: is to use https://github.com/phusion/baseimage-docker
    Which includes a "runit" init system inside the image, and it will run
    happily whatever daemon you want it to run.
    On Fri, Apr 17, 2015 at 9:45 PM, Egon wrote:
    What does your golang code look like?
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and connect
    its default port to 6379 on host and then I started my app's container and I
    get connection refused. I then tried using --link and it still doesn't work.
    The Redis container works ok because I can use redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church
    of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you simply
    need to go the supervisor route (or any process monitor of choice, thou I
    hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services
    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:

    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the background
    for my app to use it.
    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:

    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and
    I get connection refused.
    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.

    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.


    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Guianu Leon at Apr 17, 2015 at 2:05 pm
    It's a small program that outputs some text in the terminal.
    On Fri, Apr 17, 2015 at 4:45 PM, Egon wrote:

    What does your golang code look like?
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and
    connect its default port to 6379 on host and then I started my app's
    container and I get connection refused. I then tried using --link and it
    still doesn't work. The Redis container works ok because I can use
    redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church
    of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server
    in the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379
    and I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Egon at Apr 17, 2015 at 2:09 pm

    On Friday, 17 April 2015 17:06:19 UTC+3, Rayland wrote:
    It's a small program that outputs some text in the terminal.
    I mean the actual program - i.e. what library it uses to connect to redis,
    how does it select the redis host/port?

    On Fri, Apr 17, 2015 at 4:45 PM, Egon <egon...@gmail.com <javascript:>>
    wrote:
    What does your golang code look like?
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and
    connect its default port to 6379 on host and then I started my app's
    container and I get connection refused. I then tried using --link and it
    still doesn't work. The Redis container works ok because I can use
    redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the
    church of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services
    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon <guian...@gmail.com>
    wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server
    in the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379
    and I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com <javascript:>.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Guianu Leon at Apr 17, 2015 at 2:42 pm
    menteslibres.net\gosexy\redis

    It uses localhost and Redis default port 6379
    On Fri, Apr 17, 2015 at 5:08 PM, Egon wrote:
    On Friday, 17 April 2015 17:06:19 UTC+3, Rayland wrote:

    It's a small program that outputs some text in the terminal.
    I mean the actual program - i.e. what library it uses to connect to redis,
    how does it select the redis host/port?

    On Fri, Apr 17, 2015 at 4:45 PM, Egon wrote:

    What does your golang code look like?
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and
    connect its default port to 6379 on host and then I started my app's
    container and I get connection refused. I then tried using --link and it
    still doesn't work. The Redis container works ok because I can use
    redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the
    church of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services
    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon <guian...@gmail.com>
    wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server
    in the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379
    and I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Egon at Apr 17, 2015 at 6:46 pm
    Linking works fine for me with that library.
    Are you using the correct HOST/PORT that is exported via linking to the Go
    container?

    + Egon
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and connect
    its default port to 6379 on host and then I started my app's container and
    I get connection refused. I then tried using --link and it still doesn't
    work. The Redis container works ok because I can use redis-cli to acces it.

    On Fri, Apr 17, 2015 at 2:51 PM, Martin <mar...@marcher.name <javascript:>
    wrote:
    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church
    of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin

    On Fri, Apr 17, 2015 at 1:42 PM Rayland <guian...@gmail.com <javascript:>>
    wrote:
    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start the
    Redis server it still doesn't work and it will also output the server in
    the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379 and
    I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Guianu Leon at Apr 17, 2015 at 7:09 pm
    I don't think I understand what you mean. My Go app tries to connect to
    127.0.0.1:6379 and my Redis container is exporting its 6379 port to 6379
    port from host.
    On Fri, Apr 17, 2015 at 9:46 PM, Egon wrote:

    Linking works fine for me with that library.
    Are you using the correct HOST/PORT that is exported via linking to the Go
    container?

    + Egon
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and
    connect its default port to 6379 on host and then I started my app's
    container and I get connection refused. I then tried using --link and it
    still doesn't work. The Redis container works ok because I can use
    redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the church
    of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services

    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server
    in the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379
    and I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Egon at Apr 17, 2015 at 7:27 pm

    On Friday, 17 April 2015 22:09:40 UTC+3, Rayland wrote:
    I don't think I understand what you mean. My Go app tries to connect to
    127.0.0.1:6379 and my Redis container is exporting its 6379 port to 6379
    port from host.
    I got it working via running a redis container and then running the Go app
    in a container that is linked to that redis container.

    This works for connecting to a redis container (started with just docker
    run redis) https://play.golang.org/p/JoJSi6nW3f.

    If you run it inside a container, this is needed:
    https://play.golang.org/p/nVcClastS_

    docker run --link your_redis:redis your_app

    On Fri, Apr 17, 2015 at 9:46 PM, Egon <egon...@gmail.com <javascript:>>
    wrote:
    Linking works fine for me with that library.
    Are you using the correct HOST/PORT that is exported via linking to the
    Go container?

    + Egon
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and
    connect its default port to 6379 on host and then I started my app's
    container and I get connection refused. I then tried using --link and it
    still doesn't work. The Redis container works ok because I can use
    redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the
    church of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services
    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon <guian...@gmail.com>
    wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server
    in the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379
    and I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com <javascript:>.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Rick at Apr 17, 2015 at 10:40 pm
    Docker containers cannot connect to 127.0.0.1. It's a loopback address and
    isn't routed. The "docker --link container_name:hostname" option adds the
    bridge IP address of container_name to the /etc/hosts file of the container
    that's doing the linking, associating it with the hostname occurring after
    the ":". Programs running inside the container doing the linking can use
    that hostname to connect to the linked container. Bottom line - you can't
    use 127.0.0.1 inside a Docker container.
    On Friday, 17 April 2015 12:09:40 UTC-7, Rayland wrote:

    I don't think I understand what you mean. My Go app tries to connect to
    127.0.0.1:6379 and my Redis container is exporting its 6379 port to 6379
    port from host.

    On Fri, Apr 17, 2015 at 9:46 PM, Egon <egon...@gmail.com <javascript:>>
    wrote:
    Linking works fine for me with that library.
    Are you using the correct HOST/PORT that is exported via linking to the
    Go container?

    + Egon
    On Friday, 17 April 2015 14:57:48 UTC+3, Rayland wrote:

    Yes I tried starting a container from the official Redis image and
    connect its default port to 6379 on host and then I started my app's
    container and I get connection refused. I then tried using --link and it
    still doesn't work. The Redis container works ok because I can use
    redis-cli to acces it.
    On Fri, Apr 17, 2015 at 2:51 PM, Martin wrote:

    This really is about docker and has nothing to do with go at all.

    I suggest these parts for you:

    * http://docs.docker.com/articles/using_supervisord/

    And this is basically what you are trying to do (note this is the
    church of 1 process per container):

    * http://docs.docker.com/examples/running_redis_service/

    It should be easily transferable to running a redis container and a
    second one with your go application. If that doesn't work for you you
    simply need to go the supervisor route (or any process monitor of choice,
    thou I hear systemd inside docker isn't quite there yet)

    /Martin
    On Fri, Apr 17, 2015 at 1:42 PM Rayland wrote:

    I tried it and it will just output the Redis server....
    On Friday, April 17, 2015 at 2:16:24 PM UTC+3, Gijs wrote:

    This seems similar to your issue, so maybe supervisor can help you.


    http://stackoverflow.com/questions/23692470/why-cant-i-use-docker-cmd-multiple-times-to-run-multiple-services
    On Fri, Apr 17, 2015 at 1:06 PM Guianu Leon <guian...@gmail.com>
    wrote:
    Yes it seems you are right, but if I use RUN instead of CMD to start
    the Redis server it still doesn't work and it will also output the server
    in the shell which is something I don't want. I want it to be in the
    background for my app to use it.

    On Fri, Apr 17, 2015 at 2:01 PM, Gijs wrote:
    Unless something has changed since I last experimented with Docker
    (which could be the case, it's been a year), you can't have multiple CMD
    statements in your Dockerfile. You'll either need to have a separate
    container running redis or start it as a daemonized in the same CMD you
    start your Go application.

    On Friday, April 17, 2015 at 10:18:43 AM UTC+2, Rayland wrote:

    My Dockerfile looks like this:

    FROM golang:onbuild
    RUN go get [...]
    RUN apt-get update && apt-get install -y redis-server
    CMD redis-server
    CMD go run main.go

    My program needs Redis server listening on the default port 6379
    and I get connection refused.

    --
    You received this message because you are subscribed to a topic in
    the Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe
    .
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/WXHWRexuLLA/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts...@googlegroups.com <javascript:>.

    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 17, '15 at 8:18a
activeApr 17, '15 at 10:40p
posts18
users7
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase