Anyone using "docker run" instead of "docker compose"?

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”…

eager_eagle,
@eager_eagle@lemmy.world avatar

Even for the one-liner argument - a better one liner than any docker run is docker compose up [-d].

eager_eagle,
@eager_eagle@lemmy.world avatar

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.

yaaaaayPancakes,

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.

TitanLaGrange,

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.

Pixel,

Honestly I never really saw the point of it, just seems like another dependency. The compose file and the docket run commands have almost the same info. I’d rather jump to kubectl and skip compose entirely. I’d like to see a tool that can convert between these 3 formats for you. As for piping into bash, no - I’d only do it on a very trusted package.

CaptainHowdy,

I prefer to use ansible to define and provision my containers (docker/podman over containerd). For work, of course k8s and helm takes the cake. no reason to run k8s for personal self hosting, though.

Voroxpete,

I too am endlessly frustrated by documentation that lacks compose file examples.

Fortunately, this exists: Docker Compose Generator

giacomo,
@giacomo@lemmy.world avatar

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.

ghulican,

composerize.com

It’s saved me countless minutes.

giacomo,
@giacomo@lemmy.world avatar

Nice! Yeah, literally minutes, haha. I knew someone had to have already done this.

Zephyr,

use chatgpt for that… It can also create your ansible task…

giacomo,
@giacomo@lemmy.world avatar

Great… For chatgpt…

Toribor,
@Toribor@corndog.uk avatar

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.

Zephyr,

I did the same, but I started from my list of run scripts… I used ChatGPT to create them, took 2 minutes…

Toribor,
@Toribor@corndog.uk avatar

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.

CaptainHowdy,

Check out the GitHub project ansible-nas

Toribor,
@Toribor@corndog.uk avatar

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.

RedShadowWizard,

Virgin docker compose. Chad Kubectl apply.

antsu,

Kubernetes is just docker-compose with extra steps.

/s

alteredEnvoy,

I am not using docker-compose personally, and moving away from it at work, because it is only a CLI client and doesn’t integrate with other tools except she’ll scripts.

lkami,

I use docker to test individual container images. Anything long running is getting a Kubernetes manifest. I never use docker compose, except when supporting developers.

krolden,
@krolden@lemmy.ml avatar

Ive almost completely moved to podman managed by systemd and I highly recommend it.

freundTech,

Do you use podman run followed by podman generate or are you using quadlet?

Quadlet is integrated in podman 4.4 and up and makes it possible to declare your containers in .container files that look like systems unit files and still get the full systems integration: redhat.com/…/multi-container-application-podman-q…

krolden,
@krolden@lemmy.ml avatar

I just generate them. Never heard of quadlet I’m gonna check it out, thanks.

SilentMobius, (edited )

Docker-compose is a orchestration tool that wraps around the inbuilt docker functions that are exposed like “docker run”, when teaching people a tool you generally explain the base functions of the tool and then explain wrappers around that tool in terms of the functions you’ve already learned.

Similarly when you have a standalone container you generally provide the information to get the container running in terms of base docker, not an orchestration tool… unless the container must be used alongside other containers, then orchestration config is often provided.

AlexKalopsia,

I used docker run when I first started, I think it’s a fairly easy entry point that “just works”.

However I would never really go back to it, since compose is a lot tighter and offers a better sense of overview and control

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines