Docker + docker compose where is volumes?

Hi.

I’ve installed some containers throu docker compose yaml files.
It works, but i can’t see volumes in docker.

Why?

docker volume ls
DRIVER VOLUME NAME

Is there any way to see the list of volums through the command?

version: "3.3"
services:
    portainer:
      image: portainer/portainer-ce:latest
      container_name: portainer
      environment:
        - TZ=Europe/Berlin
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /opt/portainer/portainer_data:/data

As you are not using named volumes, there is not.
You use binds, which mount a host directory into a container directory.

You would need to create named volumes backed by binds, in order to get them listed as volumes:

volumes:
  data:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /opt/portainer/portainer_data

Then use - data:/data in the service volumes section to use the volume, instead of the bind you are using.

Update: I typed “directly” where it should have been “directory”. I fixed it now.

I’m new to this, but I really want to figure it out. Thank you for your post.

I want to understand how to do it correctly.

I went to the official site of nginxproxymanager
There is a ready yaml file:

version: ‘3.8’
services:
app:
image: ‘jc21/nginx-proxy-manager:latest’
restart: unless-stopped
ports:

  • ‘80:80’
  • ‘81:81’
  • ‘443:443’
    volumes:
  • ./data:/data
  • ./letsencrypt:/etc/letsencrypt

That is exactly the same way directories are mounted from the host to the container.

Thus, docker compose itself creates the necessary folders, and writes to them information that it should otherwise just write inside the container.

In practice, everything works… And my logic goes like this:

I was instructed by a developer on how to properly install his software.
I did it and it works.

Then I thought that I have a lot of containers and a volumes and it would be good to at least be able to monitor it, so that nothing is lost or deleted accidentally.

The “docker volume ls” seems to be designed for this purpose.
It prints list of volumes in the file above:

And logically they should have been output by docker.
Or do you not think so?

Should I redo the file the developer gave to see this volume, or should I accept the fact that the volume is not displayed in this case?

Please re-read my last post and quote parts that you don’t understand and try to describe in your own words what you think they might mean.