Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to expose the port when deploying the container in a swarm cluster? #11

Open
shreyas-badiger opened this issue Nov 8, 2017 · 3 comments

Comments

@shreyas-badiger
Copy link

Hi,
This image works perfectly fine when I pull the container with the "docker run" command.
I have a requirement to create an Ubuntu container with ssh capabilities on swarm cluster.
I am using the below command to do that.

docker service create --publish 22:22 --name test_sshd2 rastasheep/ubuntu-sshd:14.04

But this doesn't seem to help. The container is unable to get started.

[root@rigel lib]# docker service ps test_sshd2
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
88qf2piv799q test_sshd2.1 rastasheep/ubuntu-sshd:14.04 orion-01.local Ready Preparing less than a second ago
s48v2kgbph0o _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 orion-01.local Shutdown Rejected less than a second ago "No such image: rastasheep/ubu…"
j78z4m4ut8r1 _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 16 seconds ago "starting container failed: su…"
mmi5f86804u3 _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 26 seconds ago "starting container failed: su…"
fywjp6rgydx8 _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 32 seconds ago "starting container

Any idea about how to go ahead with this?

Thanks in advance!
Shreyas

@rastasheep
Copy link
Owner

Hi Shreyas,

I'm not totally sure what's the issue, but it seems to me that you can't bound host's port 22 to something. Can you try to bound some other port to container's 22.

Example:

docker service create --publish 49154:22 --name test_sshd2 rastasheep/ubuntu-sshd:14.04

@shreyas-badiger
Copy link
Author

No luck. :(

[shreyas@rigel ~]$ docker service create --publish 49154:22 --name test_sshd2 rastasheep/ubuntu-sshd:14.04
yvawmxgunc5clcxep0saaqsoz
Since --detach=false was not specified, tasks will be created in the background.
In a future release, --detach=false will become the default.
[shreyas@rigel ~]$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
yvawmxgunc5c test_sshd2 replicated 0/1 rastasheep/ubuntu-sshd:14.04 *:49154->22/tcp
[shreyas@rigel ~]$ docker service ps test_sshd2
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
g94wvj6wrg84 test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Ready Ready 1 second ago
xegtmt3hf4yd _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 2 seconds ago "starting container failed: su…"
tfibw7ucmdsl _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 7 seconds ago "starting container failed: su…"
xudy5obxid85 _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 12 seconds ago "starting container failed: su…"
m3g4r6lv07p8 _ test_sshd2.1 rastasheep/ubuntu-sshd:14.04 rigel.serc.iisc.in Shutdown Failed 17 seconds ago "starting container failed: su…"

@rastasheep
Copy link
Owner

Unfortunately i've also had no luck in reproducing this issue (check screenshot). Can you try to remove image and than replicate my steps?

screen shot 2017-11-08 at 7 31 13 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants