Jasmin shahrzad
asked on
docker networking
i have an ssh-sftp container on my ubuntu.
from ubuntu i add ip for container ( docker inspect "container_id")
then i can ssh and sftp from my ubuntu server to container
how to do it out of ubuntu server (on my domain)?
where to add container's ip for ssh or sftp to container?
from ubuntu i add ip for container ( docker inspect "container_id")
then i can ssh and sftp from my ubuntu server to container
how to do it out of ubuntu server (on my domain)?
where to add container's ip for ssh or sftp to container?
please describe your container in more detail.
How do you start it.
Does your container show any thing under the column PORTS
like: 0.0.0.0:1880->1880/tcp
that would mean you can use the host address with the ports mentioned before the ->
If those entries don't exist then you need to keep your containers, it will reuse the address until the container is removed.
How do you start it.
Does your container show any thing under the column PORTS
like: 0.0.0.0:1880->1880/tcp
that would mean you can use the host address with the ports mentioned before the ->
If those entries don't exist then you need to keep your containers, it will reuse the address until the container is removed.
You need to run you container with -p so ports are forwarded or possibly expose them in the dockerfile
ASKER
ok it was me.
my ftp server shows following port under docker ps
0.0.0.0:2121->2121/tcp, 0.0.0.0:2222->22/tcp
and i can start user_name_in_sftp@my_conti ainer_ip -p 2222
then i login to sftp server. is it a way to login without sending port 2222 ? i can not use port 22 in my docker-compose.
when i say ports "22:22" in my docker-compose. docker failed
failed : Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use
my ftp server shows following port under docker ps
0.0.0.0:2121->2121/tcp, 0.0.0.0:2222->22/tcp
and i can start user_name_in_sftp@my_conti
then i login to sftp server. is it a way to login without sending port 2222 ? i can not use port 22 in my docker-compose.
when i say ports "22:22" in my docker-compose. docker failed
failed : Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use
ASKER
i can login to sftp server via ssh (with user i created under create image)
i login with my user (or with docker exec -it "sftp_server" /bin/bash) and say
sudo useradd -d /upload -G sftp upload -s /usr/sbin/nologin
and add password for upload user echo "upload:opload123" | sudo chpasswd
/upload is in my docker-compose as volumes then i say sudo chown upload:sftp -R /upload
i can't sftp to my container
i say sftp upload@container-ip it ask for password i write password
failed Permission denied, please try again.
can you see what it's wrong what i missing?
i login with my user (or with docker exec -it "sftp_server" /bin/bash) and say
sudo useradd -d /upload -G sftp upload -s /usr/sbin/nologin
and add password for upload user echo "upload:opload123" | sudo chpasswd
/upload is in my docker-compose as volumes then i say sudo chown upload:sftp -R /upload
i can't sftp to my container
i say sftp upload@container-ip it ask for password i write password
failed Permission denied, please try again.
can you see what it's wrong what i missing?
ASKER
I try following in filezila:
sftp://container-ip. "username". "password" port=2222
answer: fzSftp started, protocol_version=8
command : open "user-name@container-ip" 2222
command: Pass: *********
Failed: Server unexpectedly closed network connection
Failed: Can not connect to server
sftp://container-ip. "username". "password" port=2222
answer: fzSftp started, protocol_version=8
command : open "user-name@container-ip" 2222
command: Pass: *********
Failed: Server unexpectedly closed network connection
Failed: Can not connect to server
try: container-ip:2222. "usernane" etc.
(convention is hostname:portnumber or hostname:portname in the host field to use another port.
or ithas a separate option like sft -p
(convention is hostname:portnumber or hostname:portname in the host field to use another port.
or ithas a separate option like sft -p
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Maybe you're asking how to connect access ssh + sftp inside your Docker container from external connections.
Place an update if this is what you mean.