brhahlen / dc Goto Github PK
View Code? Open in Web Editor NEWDC is my custom-made all-in-one control script to control Docker-compose stacks and containers
License: GNU General Public License v3.0
DC is my custom-made all-in-one control script to control Docker-compose stacks and containers
License: GNU General Public License v3.0
dc list
is supposed to list all services described in the docker-compose.yml
file.
While using docker-compose
, this worked by using the command ps --services -a
.
With compose
v2, this now uses the config
flag, as, rightfully, ps
should only list the running containers.
The issue is described here docker/compose#9395
Need to implement some kind of statement that changes the behavior based on the ${DC_COMMAND}
.
Also, maybe 2.0.0 will need to remove compatibility with docker-compose
.
We need docker-compose 1.25 or higher for the --env-file option, maybe check this?
Add the ability to make macvlan setup configurable.
Meaning: ability to setup ip addresses etc by yourself
Automatically create releases on a new tag and create proper zip/tar/something.
Allow logs to be followed using dc
I was experiencing DNS issues on my host, which made dc slow. Option to disable version check would be nice.
Maybe in command line and/or via environment variable (set in install)
user@hostname:~$ dc up 01-backend
Bringing up stack(s) 01-backend
/home/user/bin/dc: line 103: cd: /home/user/docker/docker-compose/01-backend: No such file or directory
ERROR:
Can't find a suitable configuration file in this directory or any
parent. Are you in the right directory?
Supported filenames: docker-compose.yml, docker-compose.yaml
/home/user/bin/dc: line 105: cd: OLDPWD not set
Some sort of implementation of cleanup/pruning: https://docs.docker.com/config/pruning/
I often find myself using dc and then cleaning up using docker pruning. It might be useful to have some support for this in dc, althought I'm unsure yet how to.
Create a check for sudo rights to be able to set macvlan and routes
user@hostname:~/docker/docker-compose$ dc restart watchtower
Restarting the following service(s): watchtower
Stopping the following service(s): watchtower
File is too old, refreshing
File is too old, refreshing
File is too old, refreshing
File is too old, refreshing
File is too old, refreshing
Stopping watchtower ... done
Going to remove watchtower
Removing watchtower ... done
Starting the following service(s): watchtower
Creating watchtower ... done
The preferred Compose file default filename is 'compose.yaml'. DC assumes 'docker-compose.yml'. See: https://docs.docker.com/compose/compose-file/03-compose-file/
Add macvlan setup - basic
When running dc update
, some wonkiness is observed.
Kind of looks like a loop, or something.
Example (Fedora):
You are on version v1.6.0 of dc
Version v2.0.1 of dc is available and will be downloaded and installed
/tmp/dc_update does not exist. Creating...
Downloading...
/tmp/dc_update/dc-release.zip 100%[===================================>] 8.60K --.-KB/s in 0s
Extracting...
Updating...
Found docker compose
Home directory is /home/download
Copying dc binary to/home/download/bin and making it executable
Copying dc-completion binary to /home/download/.bash_completion.d/ and making it executable
Removing DC_CMD variable
Done
You are on version v1.6.0 of dc
Version v2.0.1 of dc is available and will be downloaded and installed
Cleanup previous update files...
Downloading...
/tmp/dc_update/dc-release.zip 100%[====================================>] 8.60K --.-KB/s in 0s
Extracting...
Updating...
Found docker compose
Home directory is /home/download
Copying dc binary to/home/download/bin and making it executable
Copying dc-completion binary to /home/download/.bash_completion.d/ and making it executable
Done
Allow users to run dc update
(or from the version check) to download the latest version of dc
and install/update it.
Could also be part of the main "install" feature?
Add bash-completion to the script
Or, refresh on every execution (might have performance impact))
Add commands to create ip route and such
The documentation needs to be expanded with usage examples and more explanation on how it works.
Triggered by #35
Add pull functionality, to pull new images ahead of restart
Add option for more verbose output when running the script
docker compose
is the new way of using compose, that replaces docker-compose
(or so I think).
dc
will need to have this functionality.
Requiring sudo
for a user install isn't best practice for security and flexibility reasons.
The current reason that sudo
is required (as far as I can tell) is for the installation of the Bash completions. If a flag were introduced that controlled whether or not the completions were installed (either --no-completions
or --completions
, depending on the default behavior), that would allow a user to choose whether or not to install with sudo
.
Obviously, the perfect solution here would be to put the completions in a user directory, but I am unsure if Bash has this ability.
Why would I use this instead of docker-compose? What would that look like?
And display it when printing help?
maarten@balthasar:~$ dc list
Listing Stacks and Services
-----------------------------------
Stack 01-backends contains services:
/home/maarten/bin/dc: line 481: --env-file: command not found
-----------------------------------
Stack 02-system contains services:
/home/maarten/bin/dc: line 481: --env-file: command not found
-----------------------------------
Stack 03-system-frontends contains services:
/home/maarten/bin/dc: line 481: --env-file: command not found
-----------------------------------
Stack 04-home contains services:
/home/maarten/bin/dc: line 481: --env-file: command not found
-----------------------------------
Stack 05-web contains services:
/home/maarten/bin/dc: line 481: --env-file: command not found
-----------------------------------
Stack 06-media contains services:
/home/maarten/bin/dc: line 481: --env-file: command not found
maarten@balthasar:~$
maarten@balthasar:~$ dc help
Invalid command help, showing help
Usage: /home/maarten/bin/dc [command] [stacks]
Commands:
install Install dc for the user, needs sudo
up Bring up all stacks, a stack, or stacks
down Bring down all stacks, a stack or stack(s)
restart-stack-hard Restarts all stacks, a stack or stack(s)
restart-stack-soft Restarts all stacks, a stack or stack(s)
logs-stack Shows logs for a stack or stacks
start Starts one or more services
stop Stops one or more services
restart Restarts one or more services
pull Pulls an image of a service
logs Shows logs for a service or services
network Create the MacVLAN network, needs sudo
list List stacks and services in the stacks
help Print help
version Shows the version and checks the latest version
Currently, the script is quite rigid and there are a lot of things that we could into account.
Ideally, there would be the ability to allow for options, such as:
-v
for verbosity (see also #15 )--restart-only
for restarting a service, without removing it (example only)Currently using echo
and printf
in different spots in the script.
Need to ensure that there is consistency here.
Idea is to use printf
for everything that will be shown to the user, and echo
for everything that "creates" something
Since docker compose
is now the standard, v2.0.0 will drop compatibility with docker-compose
.
Also see #46 , as there is some config change there.
Usage: /home/maarten/bin/dc [options] [stacks/
should be
Usage: /home/maarten/bin/dc [options] [stacks]
I cannot restart stacks with dc, only containers. It would be nice to also be able to restart stacks.
Simplest way of installing the program.
Needs to do:
~/bin
~/.bashrc
DC_DIR
and set to PATHUsing "dc prune system" leaves unreferenced images remaining.
https://docs.docker.com/engine/reference/commandline/image_prune/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.