Comments (10)
When the FTP connection closes, the vsftpd process closes down, then the container shuts down. I think this is not what should happen when listen=YES.
I looked into it and I'm afraid that this is vsftpd
's intended behaviour when you have background=NO
in the daemon's config.
When background=YES
the daemon does not close down after a connection, but the process is backgrounded as soon as it is launched.
Too bad this violates docker's logic - by design, the monitored process must stay in the foreground else the container closes down. So you have to keep the container up with a trick, like @aminvakil suggested with sleep infinity
, which keeps the monitored shell script alive.
It actually works, but it's not good practice, since now the container status does not reflect the daemon's status - vsftpd can crash and the container will merrily still be up because the sleep
process keeps it up.
But if I am not mistaken, given vsftpd's (I'd say flawed) design, the only way around this is designing a watchdog script - maybe just a one-liner while
that loops as long as it finds vsftpd running:
while [ "$(ps ax | grep /usr/sbin/vsftpd | grep -v grep)" ]; do sleep 30s; done
(maybe this will need procps)
Also
--restart unless-stopped
is more suitable in this case imho.
I think I can see where this comes from, but again, the container's restart policy should have nothing to do with keeping it up when it's working.
from docker-alpine-ftp-server.
@delfer Thanks for your great docker image.
I have forked this as I wanted to implement ssl in it.
This issue happened for me as well, but unfortunately some clients didn't reconnect on multiple restarts, therefore I have fixed this by adding a sleep infinity
at the exec
command in start_vsftpd.sh
like this:
https://github.com/aminvakil/docker-alpine-ftp-server-tls/blob/288d9dcc30a96874a33596183c64a1997923754d/start_vsftpd.sh#L57
Also --restart unless-stopped
is more suitable in this case imho.
from docker-alpine-ftp-server.
Sorry, talking about Docker (I'm usign this image ASIS, I don't want to edit the config or the entrypoint script) how can I set the --restart option?
EDIT: nvm, thanks @aminvakil for pointing to your fork, it works really fine
from docker-alpine-ftp-server.
while [ "$(ps ax | grep /usr/sbin/vsftpd | grep -v grep)" ]; do sleep 30s; done
(maybe this will need procps)This does not help too much as well as it does not check various problems which may be caused rather than process getting killed completely.
That was admittedly a quick fix, but then again, its purpose is to keep the container up just as long as the main vsftpd
process is running, just like a foreground process would behave. We're not talking health checks here, there is HEALTHCHECK for that.
from docker-alpine-ftp-server.
Hi @m0rph03nix where you able to solve this? Thanks.
from docker-alpine-ftp-server.
It looks like this is a normal situation. My instance has 77 restarts for 8 days working. And every time it's "ExitCode: 0". No one error. Just try to add "--restart always".
from docker-alpine-ftp-server.
Thanks, it works.
from docker-alpine-ftp-server.
I have forked and I'm having the same problem too, but I don't want the container to restart. I'm trying to understand why this is happening. It looks like vsftpd is not working as it's daemonized, but as it would under inetd. When the FTP connection closes, the vsftpd process closes down, then the container shuts down. I think this is not what should happen when listen=YES.
from docker-alpine-ftp-server.
Too bad this violates docker's logic - by design, the monitored process must stay in the foreground else the container closes down. So you have to keep the container up with a trick, like @aminvakil suggested with
sleep infinity
, which keeps the monitored shell script alive.
It actually works, but it's not good practice, since now the container status does not reflect the daemon's status - vsftpd can crash and the container will merrily still be up because thesleep
process keeps it up.
But if I am not mistaken, given vsftpd's (I'd say flawed) design, the only way around this is designing a watchdog script - maybe just a one-linerwhile
that loops as long as it finds vsftpd running:
while [ "$(ps ax | grep /usr/sbin/vsftpd | grep -v grep)" ]; do sleep 30s; done
(maybe this will need procps)
This does not help too much as well as it does not check various problems which may be caused rather than process getting killed completely.
Also
--restart unless-stopped
is more suitable in this case imho.I think I can see where this comes from, but again, the container's restart policy should have nothing to do with keeping it up when it's working.
You're right, this is irrelevant to this issue, just wanted to mention it.
from docker-alpine-ftp-server.
Fixed in #36
from docker-alpine-ftp-server.
Related Issues (20)
- `adduser: uid '82' in use` HOT 2
- ls command returns 500 Bad EPRT protocol. ftp: bind: Address already in use HOT 1
- How to set local timezome? HOT 2
- Can't deploying multiple users HOT 1
- How do I map a volume on the Docker host? HOT 2
- Container dies after: "adduser: user 'ftp_user' in use" HOT 2
- enable some additional features to be set by variable? HOT 1
- client connect failed HOT 1
- Cant store files when starting integration test on gitlab runner HOT 1
- default configuration does not list dot files (so called "hidden" files) via NLST HOT 2
- container undeterministically dies directly after startup HOT 6
- Process quitting on startup on RHEL7 HOT 10
- There is an error in the FTPS documentation HOT 1
- Remove TLSv1 Support HOT 3
- Why is there only "latest" tag on DockerHub? HOT 1
- Container error illegal character with code 34 at position 0 HOT 1
- no connection with letsencrypt cert HOT 3
- what is use of volume ftp/ftp is in dockerfile? HOT 3
- environment seems wrong
- How set read-only permission? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-alpine-ftp-server.