Open allamand opened 8 years ago
Hi, only docker-compose.yml projects are supported, at the moment.
I will investigate about the technical feasibility of this
@allamand If you want to use something like docker-compose -f docker-compose.yml -f docker-compose.a.yml up
you can create .env
file in directory with those files and put there:
COMPOSE_FILE=docker-compose.yml:docker-compose.a.yml
. You should be able to use multiple compose files, but one should be named docker-compose.yml
.
+1 I have created a tool that "recompose" the docker command line via a config file (https://github.com/edyan/stakkr : it reads a list of services to start and get the right yml files). That's completely dynamic and I can't use your UI (unfortunately!).
My config files are there : https://github.com/edyan/stakkr/tree/master/stakkr/static/services + I use a lot of env variables ...
As docker compose has no api and it's a pure cli tool, maybe it's impossible to "guess" what has been loaded ?
Thanks !
Edit : I found a way to write the full config dumped from docker-compose config
and to mount it in a directory that I set as the working dir ... but that does not work ... i have a GUI with no containers. My config is the following (am I missing something?):
networks:
stakkr:
driver: bridge
ipam:
config:
- subnet: 192.168.102.0/24
services:
apache:
container_name: mydev_apache
environment:
APACHE_GID: '1000'
APACHE_UID: '1000'
hostname: mydev_apache
image: edyan/apache:2.2
links:
- php
mem_limit: 512M
networks:
stakkr: null
volumes:
- /projects/mydev/home/www-data:/home/www-data:rw
- /projects/mydev/logs/apache:/var/log/apache2:rw
- /projects/mydev/www:/var/www:rw
compose-ui:
container_name: mydev_ui
hostname: mydev_ui
image: francescou/docker-compose-ui
networks:
stakkr: null
volumes:
- /tmp/stakkr/mydev:/compose-files/stakkr:rw
- /var/run/docker.sock:/var/run/docker.sock:rw
working_dir: /compose-files
elasticsearch:
container_name: mydev_elasticsearch
hostname: mydev_elasticsearch
image: elasticsearch:1.6
mem_limit: 512M
networks:
stakkr: null
volumes:
- /projects/mydev/data/elasticsearch:/usr/share/elasticsearch/data:rw
maildev:
container_name: mydev_maildev
hostname: mydev_maildev
image: djfarrelly/maildev
networks:
stakkr: null
mysql:
container_name: mydev_mysql
environment:
MYSQL_ROOT_PASSWORD: changeme
hostname: mydev_mysql
image: mysql:5.5
mem_limit: 1024M
networks:
stakkr: null
volumes:
- /projects/mydev/conf/mysql-override:/etc/mysql/conf.d:rw
- /projects/mydev/data/mysql:/var/lib/mysql:rw
php:
cap_add:
- NET_ADMIN
- NET_RAW
container_name: mydev_php
environment:
ENVIRONMENT: dev
FPM_GID: '1000'
FPM_UID: '1000'
hostname: mydev_php
image: edyan/php:5.6-git
mem_limit: 512M
networks:
stakkr: null
volumes:
- /projects/mydev/conf/php-fpm-override:/etc/php/7.0/fpm/user-conf.d:rw
- /projects/mydev/conf/php-fpm-override:/etc/php/7.1/fpm/user-conf.d:rw
- /projects/mydev/conf/php-fpm-override:/etc/php/7.2/fpm/user-conf.d:rw
- /projects/mydev/conf/php-fpm-override:/etc/php5/fpm/user-conf.d:rw
- /projects/mydev/home/www-data:/home/www-data:rw
- /projects/mydev/logs/php:/var/log/php:rw
- /projects/mydev/www:/var/www:rw
phpmyadmin:
container_name: mydev_phpmyadmin
environment:
PHP_UPLOAD_MAX_FILESIZE: 128M
PMA_HOSTS: mysql
PMA_PASSWORD: changeme
PMA_USER: root
hostname: mydev_phpmyadmin
image: phpmyadmin/phpmyadmin
networks:
stakkr: null
version: '2.2'
Hello @edyan could you please tell me the steps to reproduce the issue?
I see you mount a volume /tmp/stakkr/mydev:/compose-files/stakkr:rw
inside the docker-compose-ui container, I guess this folder contains the output of doker-compose config
?
Hi @francescou, yes that's the output ... to reproduce actually you'll have to install my tool (http://stakkr.readthedocs.io/en/latest/pages/installation.html#installation-under-linux) then dump the config (stakkr-compose config
) somewhere like I did, then mount it with your image and see if you get a list. Of course that takes time so if I can help ... let me know !
do you save the output of stakkr-compose config
to a file named docker-compose.yml ?
yes I put it into /tmp/stakkr/mydev and I mount that that I set as a workdir.
From your app I see the conf I have pasted above so it's taken into account
ok so you can see your docker-compose project in the docker-compose-ui "Projects" left column, right?
Absolutely but I have no container to start / stop, etc ...
at the very beginning you don't have any service running, so you will not see any service until you click on "up" (docker-compose up
).
Ok ! So you read events from docker but don't read the initial state, right ? (as I set docker-compose-ui in my docker-compose.yml, it starts at the same time than other containers).
Yes, it's correct: you can see the services only after the docker composition has been created.
since you are running docker-compose-ui using that docker-compose.yml file you should be able to see all the services as long the docker compose project name is equal to the name of the folder containing the docker-compose.yml file.
For example, if you start a composition /tmp/stakkr/mydev/my-stakkr/docker-compose.yml
you will see a project named "my-stakkr" on the left column of docker-compose-ui that should be active (a green "on" label should be displayed).
Otherwise, check is the output of docker inspect docker_compose_ui | jq '.[0].Config.Labels["com.docker.compose.project"]' -r
is equal to "my-stakkr"
Hi @francescou
My feedback :
/tmp/stakk:/compose-files:rw
and not /tmp/stakkr/mydev:/compose-files/stakkr:rw
, that works well, I see my project and I can start / stop my container. And .... I can do an up
from outside, reload the page and see a change in the status (so it's dynamic, and it's great). Conclusion:
$(pwd)
by $(dirname $(pwd))
and I think that'll work !Thanks for your support
EDIT : for people who use multiple yml file, do a docker-compose config
, dump your config in a directory, mount the parent directory of that directory and you'll be able to use docker-compose-ui
!
@edyan you're right. Thank you very much, I've fixed the documentation.
Hello,
Is it possible for compose-ui instead of reading docker-compose.yml file, to read docker-compose*.yml files ?
I used to specify several docker-compose-files with -f when using docker-compose, that allow me to simplify big docker-compose file maintenability ex :