Open honsiorovskyi opened 8 years ago
Proposal
Assume a command app create
which takes N named arguments and produces a docker-compose.yml
file using the corresponging directives in exactly the same order. This command should be as much compatible with the standard docker run
as possible.
Example input:
app create --name proxy \
--service nginx \
--image docker.io/nginx \
--restart always \
--volume "/data/proxy/config:/etc/nginx" \
--volume "/data/proxy/logs:/var/log/nginx" \
--env-file proxy.env \
--env "constraint:node_type==frontend" \
--service redis \
--image docker.io/redis \
--restart always \
--volume "/data/proxy/db:/var/lib/redis" \
--env "constraint:node_type==db"
Example output:
# proxy.yml
nginx:
image: docker.io/nginx
restart: always
volumes:
- "/data/proxy/config:/etc/nginx"
- "/data/proxy/logs:/var/log/nginx"
env-file: proxy.env
environment:
- "constraint:node_type==frontend"
redis:
image: docker.io/redis
restart: always
volumes:
- "/data/proxy/db:/var/lib/redis"
environment:
- "constraint:node_type==db"
Now we have an experimental implementation for this feature, although its syntax is compatible with docker-compose.yml
directives, not Docker itself. This decision has its pros and cons, but basically it's simpler to implement, to test to understand, and it's also not so hard to rewrite Docker run
command line to fit docker-compose, so it stays for now.
Currently supported almost all directives from docker-compose.yml
except for that ones which belong to the version 2. Version 2 is not supported yet.
Provide a simple interface to create new application specifications using command line.