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 can I change server port 21 to other port(e.g. 11121) #127

Closed
jujis008 opened this issue Feb 17, 2020 · 7 comments
Closed

How can I change server port 21 to other port(e.g. 11121) #127

jujis008 opened this issue Feb 17, 2020 · 7 comments
Labels

Comments

@jujis008
Copy link

jujis008 commented Feb 17, 2020

I running docker-compose with the configuration file:
`services:

ftp:
image: stilliard/pure-ftpd:hardened
environment:
- FTP_USER_NAME=test
- FTP_USER_PASS=abcd
- FTP_USER_HOME=/home/test
volumes:
- test-data:/home/test
ports:
- "12321:21"
- "30000-30009:30000-30009"
network_mode: host
restart: unless-stopped`

when I run up server still running at port 21.
How can I change to my specific port?

@stilliard
Copy link
Owner

Hey @jujis008

I've tested your example file and it looks like the network_mode: host line causes it to not work, commenting this out or removing it fixes the issue for me.

I've found the following link which seems to suggest the port mapping doesn't work with network_mode: host
https://docs.docker.com/compose/compose-file/#ports

Hope this helps.

@jujis008
Copy link
Author

jujis008 commented Feb 18, 2020

Exactly as you said, I changed network_mode type to default(bridge) but got another problem, I connected to localhost 12321, trying to execute a command got an error.
`230 OK. Current directory is /

Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
500 I won't open a connection to 127.0.0.1 (only to 172.17.0.1)
ftp: bind: Address already in use
ftp> `

@stilliard
Copy link
Owner

Ah no worries, this error happens when pure-ftpd can't bind the address, try adding the following to the environment section: PUBLICHOST: "localhost"

@jujis008
Copy link
Author

Yes, I did, but the same thing happened.BTW, I'm using ubuntu OS.

@stilliard
Copy link
Owner

stilliard commented Feb 24, 2020

That's cool, I'm on ubuntu too.
Could you paste me your latest compose file please? Thank you

@jujis008
Copy link
Author

Thank you stilliard~, here is the compose file
`version: '3'

services:
ftp:
image: stilliard/pure-ftpd:hardened
environment:
- FTP_USER_NAME=user
- FTP_USER_PASS=pass
- FTP_USER_HOME=/home/user
- PUBLICHOST=localhost
volumes:
- user-data:/home/user
ports:
- "11121:21"
- 30000-30009:30000-30009
network_mode: default
restart: unless-stopped

volumes:
user-data:
driver: local
`

@stilliard
Copy link
Owner

Hi @jujis008
Hope you're doing well and staying safe.

Sorry I missed your reply here.
Start of the year became pretty busy unfortunately.

Not sure if you resolved this issue yourself in the end but looking through I've not seen network_mode: default before, maybe try removing that line and see if that fixes it.

Otherwise, my other suggestion is to try the compose example in the repo: https://github.com/stilliard/docker-pure-ftpd/blob/master/docker-compose.yml
It's a v2 example rather than v3 like yours but still works with the latest docker-compose.

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

No branches or pull requests

2 participants