this post was submitted on 26 Sep 2024
30 points (96.9% liked)
Programmer Humor
19813 readers
173 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I've often been able to
alias drun='docker compose run --rm --build'
and simplify down to:Should be able to encode all those wayward args into
docker-compose.yml
orDockerfile
and only use vanilla docker commands -- that's the whole point of containerizationThe env file is the weirdest part, the container itself has a required environment variable and if I don’t pass it in command line (only have it in the test compose file) the base compose fails because it has no port.
Most of the other commands are to merge the compose files so I can keep my base compose file clean!
Simpler to keep everything in one compose file if you can, under a
test
service that doesn't build unless explicitly namedUn-weird that env var and use the normal, boring feature of defining
environment
under yourtest
serviceThe variable is already in the environment, it just doesn’t have a default because it’s required for each container
You can reference envs from the host in docker compose, so code it in instead of manually passing tribal knowledge in: https://stackoverflow.com/a/73826410
Yep, you can also set defaults, required, alternates, etc
This discussion did help me realize that my problem was that I forgot an
!override
on one of my service’s options. Now it’s just merging the two compose files and setting the profile, thanks for that!