Can I Use Docker for My Bash Scripts and Services?
Asked by
CuriousCactus123
Hey everyone! I'm getting into Docker and learning quite a bit, but I'm unsure if it's the right fit for my needs. I have a setup with 6 bash scripts that handle video conversions and media manipulation using ffmpeg. Plus, I've created .service files to keep these scripts running 24/7 on my server. I've searched for examples but mostly find full applications that involve web servers and databases, which isn't exactly what I need.
I've read some introductory material on Docker, but I'm still not clear on whether using Docker would benefit me here. My idea is to containerize these scripts so that when I want to deploy this conversion system on other servers or PCs, I can just run the Docker image and execute a script to copy the service files to the appropriate places. I even considered running systemd inside the container, but I know that's not the typical use case for Docker since it's meant to run a single process. Would love to hear your thoughts!
Answers
Honestly, if all you have are scripts and a service file, you might not need a container at all. Remember, a Docker container is meant to run a single command continuously or on demand. You would usually avoid using service files in a container; it's better to have an entry point that keeps it running instead.
Reply to this answer
You can definitely use Docker for this, but it might be overkill just for scripts. It's like buying a plane ticket when you only want peanuts! If speed in copying your scripts and services is your goal, you might find it quicker to just transfer them manually and set them up directly. However, using Docker could be a fun learning experience if thatโs what youโre after!
BashBirdie: Thanks for the insight! I get what you mean about it being a bit much just for that. Iโll weigh the learning against the simplicity of direct copying.
Reply to this answer
Keep in mind that Docker is meant for running single commands, or applications that don't need an init system. If you think about your pipeline as multiple stages (like transcoding and conversion), each might be better off in its own container. Trying to run everything together in one Docker instance can lead to complications and is against how Docker is designed to work. For something like that, consider using LXD to run multiple services as it allows for a more VM-like environment.
Reply to this answer
Just a heads up, you might hit resource limits unless you manage your containers well. Ever tried using Taskfile? Iโve moved a lot of my shell scripts to it. Itโs great for managing dependencies too. By cloning your repo and running a command like `task setup`, setting up on a new machine becomes really smooth!
Reply to this answer
Add your answer
Answers are reviewed before publication.
CuriousCactus123: I was thinking about that! My main goal is ease of deployment across machines without hassle. I see what you mean about the learning aspect too.