I am facing a problem while setting up a docker container for FTP server. Any help will be appreciated.
My requirement is to run a docker container with ftp service with out any intervention. ie, vsftp service should run when docker starts and I tried to create a container with below steps but service is not starting automatically.
Things I have done.
Docker rhel image imported and installed vsftpd service and configured ftp service.
Added entry in /etc/rc.local " /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf " to run the service at startup
commit the image to new name
Created a container using new image and I could see all the configuration but ftp service is failed to start.
Tried execute the sh /etc/rc.local and service is started ( Note : execute permission were given to /etc/rc.local )
Please share the exact command you used to start your container. I can only assume that you did not specify a restart policy in your command.
Also a ftp server might not the best kind of service to containerize, see https://stackoverflow.com/a/60692544/3460948. You would need to publish a huge range of passv ports for the container, which is possible, but will add a huge delay while starting the container.
You might want to search the forum for differences between (docker) containers and vms. You approach looks like you try to force vm patterns to the container world.
May I suggest to start of with a pre-existing image from Docker Hub, like fauria/vsftpd ? You can take a peek into its Dockerfile (in its github repo) and build up understanding on how to properly build an image…
Also, I’d like to suggest this fabulous free self-paced docker training: https://container.training/intro-selfpaced.yml.html. It helps a lot if you know at least the basics… knowledge beyond the basics doesn’t hurt either.
Don’t be afraid of the number of slides, you can rush thru most of them within seconds. Perform all excercices to get a better understanding. Those are realy good training slides. Its definitly worth the time you spend to work them true!
Once you get a better understanding, things will get more clear