-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No volumes: section. docker-compose: no declaration was found in the volumes section #17
Comments
If you run "docker inspect portainer", what does the volume/bind-mount section look like for that container? |
for clarification. Output: mean output from the script autocompose and the missing part is need to reimport with docker-compose up -d. Without the three lines I got the Error. portainer_data is a volume. Do you mean this parts ? |
I think this has been fixed in some recent updates. Try using the latest image below and see if that fixes the issue.
|
Hi, actually just checked and I see the same issue. Volumes section is missing. |
I'm having the same issue. See below:
|
Following up - at https://github.com/Red5d/docker-autocompose/blob/master/autocompose.py#L66
change to:
I don't have any examples that include the read/write mode, so I'm unsure if that exists under the Mounts section. |
@damntourists thanks, I've got a really busy weekend, but I'll check on this after. If you've verified that it works, feel free to submit a pull request to change that item and I'll review/merge it. |
@Red5d will you be merging that fix soon ; |
running into this same problem, is there an open pr for this? |
* fix volume export based off of #17 (comment) * remove unneeded space * export volumes in addition to networks * fix syntax error * actuall fix syntax errors Co-authored-by: Adam Doussan <[email protected]>
I ran into a similar problem. The latest version seems to ignores binds and the read only flag. As far as I understand we need a volume list returned in the value dict for volumes and binds + a volume dict stating which volumes already exist and should be reused (are 'external'). Type 'bind' should use its source instead of a name in the compose file (only volumes have names). The code below seems to dot that, at least for my containers (both volumes and binds, and some read only). It also adds the ":ro" when needed. EDIT: I also made the reuse of existing volumes optional with a --createvolumes command line argument.
|
One PR that includes my suggestions for Red5d#17 and some new ones: The -all option would not work because every iteration of container_names could set the 'networks' and 'volumes' to None. Even if a previous container had a network. Later iterations could not add a network, because it was no longer a dict, resulting in an exception. The code might need some cleaning up. I left some comments and old pieces (commented out) to explain to @Red5d what I did and why. Since I am new to this script and the docker-compose format i might have overlooked something. Please check.
I have made a PR of the code above and including some other modifications/fixes. |
) (from @d-EScape) One PR that includes my suggestions for #17 and some new ones: The -all option would not work because every iteration of container_names could set the 'networks' and 'volumes' to None. Even if a previous container had a network. Later iterations could not add a network, because it was no longer a dict, resulting in an exception. The code might need some cleaning up. I left some comments and old pieces (commented out) to explain to @Red5d what I did and why. Since I am new to this script and the docker-compose format i might have overlooked something. Please check. Co-authored-by: d-EScape <[email protected]>
@d-EScape , thanks! The PR wasn't actually submitted to the repo, but I created one and merged it. I also made an additional commit just now to increase the compose file version number to 3.6 which is necessary for the output compose file to pass validation using "docker-compose config" with the current network/volume config capabilities that have been included in the script recently. |
This appears to still be happening with named volumes. For instance:
Note lack of volumes section despite a named volume ( |
@Anaerin , am I looking at the wrong thing? The compose file in your comment has a volumes section with a "grafana-storage" volume 5-6 lines from the bottom. |
Yes, that's for the container. The image should then be defined in a separate "volumes" section, and as this is using a named volume, it should be declared as "external". For example:
|
Can you provide the "docker inspect" output for your container? |
And now after doing the move over from aufs to overlay2 it's working. That's odd. |
I had test it for example with portainer.
because there is no volumes section, docker-compose raise an error.
docker-compose: no declaration was found in the volumes section
Output:
version: "3"
services:
portainer:
container_name: portainer
entrypoint:
- /portainer
environment:
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
hostname: 744e2324ef35
image: portainer/portainer-ce
ipc: private
logging:
driver: json-file
options: {}
networks:
- bridge
ports:
- 8000:8000/tcp
- 9000:9000/tcp
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
working_dir: /
networks:
bridge:
Missing in iml file something like this.
volumes:
portainer_data:
external: true
The text was updated successfully, but these errors were encountered: