For the vast majority of docker images, the documentation only mention a super long and hard to understand “docker run” one liner.
Why nobody is placing an example docker-compose.yml in their documentation? It’s so tidy and easy to understand, also much easier to run in the future, just set and forget.
If every image had an yml to just copy, I could get it running in a few seconds, instead I have to decode the line to become an yml
I want to know if it’s just me that I’m out of touch and should use “docker run” or it’s just that an “one liner” looks much tidier in the docs. Like to say “hey just copy and paste this line to run the container. You don’t understand what it does? Who cares”
The worst are the ones that are piping directly from curl to “sudo bash”…
Because it’s “quick start”. Least effort to get a taste of it. For actual deployment I would use compose as well.
Many project also have a example docker-compose.yml in the repository if you dig not so deep into it
There is https://www.composerize.com to convert run command to compose. Works ~80% of the time.
I honestly don’t understand why anyone would make “curl and bash” the officially installation method these days, with docker around. Unless this is the ONLY thing you install on the system, so many things can go wrong.
I used to host composerize. Now I host it-tools which has its own version and many other super helpful tools!
You have changed my life today.
No, the creator of it-tools did. I just told you about it. Give them a star on GitHub and maybe donate if you can ❤️
you don’t have to decode anything… just throw it in here :
it turns out GPT converts plain docker commands into docker compose files well enough to me, it’s been my go-to when I need to create a compose YAML. Checking a YAML and making one or two small corrections is even faster than entering all info in a form like Docker Compose Generator.
Even for the one-liner argument - a better one liner than any docker run is
docker compose up [-d]
.Previously my server was just a Debian box where I had a ‘docker’ directory with a bunch of .sh files containing ‘docker run’ commands (and a couple of docker-compose files for services that that have closely related containers). That works really well, it’s easy to understand and manage. I had nginx running natively to expose stuff as necessary.
Recently I decided to try TrueNAS Scale (I wanted more reliable storage for my media library, which is large enough to be annoying to replace when a simple drive fails), and I’m still trying to figure it out. It’s kind of a pain in the ass for running containers since the documentation is garbage. The web interface is kind of nice (other than constantly logging me out), but the learning curve for charts and exposing services has been tough, and it seems that ZFS is just a bad choice for Docker.
I was attracted to the idea of being able to run my services on my NAS server as one appliance, but it’s feeling like TrueNAS Scale is way too complicated for home-scale (and way too primitive for commercial, not entirely sure what market they are aiming for) and I’m considering dumping it and setting up two servers, one for NAS and for running my containers and VMs.
Ive almost completely moved to podman managed by systemd and I highly recommend it.
I too am endlessly frustrated by documentation that lacks compose file examples.
Fortunately, this exists: Docker Compose Generator
First version of my server, I wrote a bunch of custom shell scripts to execute
docker run
statements to launch all my containers b/c I didn’t know docker at all and didn’t want to learn compose.Current version of my server, I use docker compose. But all the containers I use come from linuxserver.io, and they always give examples for both. I use ansible to deploy everything.
Virgin docker compose. Chad Kubectl apply.
Kubernetes is just docker-compose with extra steps.
/s
I’ve started replacing my docker compose files with pure ansible that is the equivilent of doing docker run. My ansible playbooks look almost exactly like my compose file but they can also create folders, set config files or cycle services when configs are updated.
It’s been a bit of a learning process but it’s replaced a lot what was previously documentation with code instead.
I did the same, but I started from my list of run scripts… I used ChatGPT to create them, took 2 minutes…
Hahaha, I’ve been using ChatGPT in the exact same way. It requires a bit of double-checking but it really speeds things up a lot.
Check out the GitHub project ansible-nas
ansible-nas
Wow, yeah this is exactly the sort of roles/playbooks that I’ve been building. I’m definitely using this as a source before starting my own from scratch. Thanks for sharing.
I don’t think you’re out of touch, just use docker compose. It’s not that hard to conver the
docker run
example command line into a neatdocker-compose.yml
, if they don’t already provide one for you. So much better than just running containers manually.Also, you should always understand what any command or docker compose file does before you run it! And don’t blindly
curl | bash
either, download the bash script and look at it first.Nah I’ll just copy paste half the tutorial in one go and then blame others when things break
Average linux user /s
I’m sure someone has written a script to convert docker run commands to compose files.
I am usually customizing variables and tend to use compose for anything I am planning on running in “production”. I’ll use run if it’s a temporary or on-demand use container.
It’s not really that much effort to write a compose file with the variables from a run command, but you do have to keep an eye on formatting.
use chatgpt for that… It can also create your ansible task…
Great… For chatgpt…