compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose.yml should support every docker run option

Open bfirsh opened this issue 11 years ago • 30 comments

Notable things missing:

  • [x] add-host https://github.com/docker/fig/issues/597 https://github.com/docker/compose/pull/1158
  • [x] cpuset https://github.com/docker/compose/pull/685
  • [x] device https://github.com/docker/compose/commit/df87bd91
  • [x] memswap_limit https://github.com/docker/fig/pull/685
  • [x] mac_address added in this commit: https://github.com/docker/compose/commit/b76ac6e6

The following run options aren't in docker-py; cpuset-mems, cpu-period, cpu-quota, oom-kill-disable, sig-proxy

Related: #363

Examples: https://github.com/docker/compose/pull/293 https://github.com/docker/compose/pull/830

bfirsh avatar Dec 23 '14 12:12 bfirsh

Any progress with add-host https://github.com/docker/fig/issues/597? In docker-py support is already present https://github.com/docker/docker-py/pull/400 from 0.7.0.

Ideally if configuration would look like this

hosts:
   hostname: ip

mishak87 avatar Jan 14 '15 16:01 mishak87

AFAICT support for "device" is also present in docker-py (see https://github.com/docker/docker-py/pull/373)

dommmel avatar Jan 29 '15 20:01 dommmel

+1 for #597

gpolyn avatar Feb 03 '15 17:02 gpolyn

I really need this feature: #597

zhucegep avatar Feb 05 '15 04:02 zhucegep

@zhucegep you can try crane which supports it

mishak87 avatar Feb 05 '15 13:02 mishak87

@bfirsh are memswap_limit and cpuset not integrated into docker-compose yet?

razic avatar Feb 08 '15 02:02 razic

also i'm trying to use cpu_shares which looks to be defined here, but doesn't seem to actually be working... https://github.com/docker/fig/blob/master/compose/service.py#L21

razic avatar Feb 08 '15 02:02 razic

@mishak87 thank you, I had implement this feature on environment variable.

usage:

environment:
    HOSTS:  "zookeeper zookeeper.example.com\n172.17.42.1 my.own.com"

impl:

#! /bin/bash
echo  "# host config by docker" >> /etc/hosts
echo  "$HOSTS" | while read line 
do
  link_service_name=`echo $line | cut -d" " -f1`
  ip=$link_service_name
  # if does not contain "." then change it to ip from env
  [[ $ip =~ "." ]] || ip=`env | grep TCP=tcp:// | grep -i $link_service_name | cut -d"/" -f3 | cut -d":" -f1 | sort | uniq`
  # replace service name to ip, and echo to /etc/hosts
  echo $line | sed s/$link_service_name/$ip/g >> /etc/hosts
done

zhucegep avatar Feb 13 '15 04:02 zhucegep

+1 for #597

nexus49 avatar Feb 21 '15 16:02 nexus49

Any updates on docker-compose supporting the device option?:

--device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)

cancan101 avatar Feb 27 '15 16:02 cancan101

cpuset?

gastonmorixe avatar Mar 27 '15 04:03 gastonmorixe

I've added some examples of pull requests adding docker-compose.yml options in case anybody needs an example to help them implement these.

bfirsh avatar Mar 30 '15 12:03 bfirsh

@bfirsh cool, may I know why can't we add a fallback way to send whatever run param we want? so we are not always behind docker. Soon docker will have logs driver/limits, I'd love to use that even under a RC, but I can't without patching compose too.

Thanks

gastonmorixe avatar Mar 30 '15 14:03 gastonmorixe

@imton IMO it is necessary to synchronize feature releases of docker with compose so it does not lag behind. Maybe using it for regression/integration tests so it is always necessary to keep it up-to-date.

But since receiving new name, lets hope it will be also receiving the attention it deserves!

mishak87 avatar Mar 30 '15 16:03 mishak87

@mishak87 while I understand what you say, I don't agree. I think docker changes so fast we have to have fallback and for docker's betas/RC we won't be updating compose.

gastonmorixe avatar Mar 30 '15 16:03 gastonmorixe

TL;DR Current state leads to tools/forks like crane which implement more features and react faster. Maybe it would be faster to make decision on format/behaviour and let community to help out with implementation.

@imton That does not make sense to me from product perspective. We are talking about tool that orchestrates docker containers by reading single configuration.

I really do appreciate the pace with which docker keeps on significantly improving with each version, but leaving this tool in dust behind is bad. It would be like publishing golang 1.4 but only with tools supporting 1.3 features.

For a docker newcomer, composer is already part of official documentation. I would implicitly assume it is in lock with at least last stable version of docker. It is not useful to me for development and playing with, if I can't use new features.

From technical point of view it is confusing at least for me personally. I would expect compose to contain 90% of generated code from some hashmap of possible config values crossed with docker-py feature set. Maybe it would make sense to leave it with open-source community so you can focus on docker alone. Maybe you could decide how configuration should look like and ask for pull requests? I could promise you to make at least one each month for at least a year.

mishak87 avatar Mar 30 '15 20:03 mishak87

+1 for #597

pahud avatar Apr 07 '15 00:04 pahud

+1 for #597

blankenhaus avatar Apr 07 '15 18:04 blankenhaus

I want to help but there's no in-source docs :( – need add-hosts as well. How do you run the tests?

tj avatar Apr 13 '15 16:04 tj

@tj Instructions on how to run the tests is in the contributing docs. Here's an example of adding an option if that's helpful: https://github.com/docker/compose/pull/830

Give us a shout in #docker-compose on Freenode if you need a hand with anything. :)

bfirsh avatar Apr 14 '15 00:04 bfirsh