jesseduffield / lazydocker

The lazier way to manage everything docker
MIT License
37.08k stars 1.19k forks source link

Services section has disappeared #173

Closed ThisIsMissEm closed 2 years ago

ThisIsMissEm commented 5 years ago

Describe the bug I've been using lazydocker for a while, all from the same directory. I had to restart it a few moments ago, and the Services section has completely disappeared, despite there being services running via docker-compose up

To Reproduce No idea, it just randomly happened.

Expected behaviour I should see a list of services, as I have services running

Screenshots Note: I've had to hide the names of what I'm actually running

Screenshot 2019-09-16 at 04 04 16

Desktop (please complete the following information):

Additional context n/a

ThisIsMissEm commented 5 years ago

Sorry, ignore this, I think: I wasn't seeing the services because docker-compose config failed due to a missing environment variable that it uses (it used to come from my zshrc, and then I moved to envchain, so the environment variable didn't exist, causing the command to fail).

Maybe it's worth displaying an error message if the docker-compose file cannot be parsed/loaded?

gggeek commented 4 years ago

This seems to be happening to me as well - 1ast time I use lazydocker though, so I am not even aware that a 'services' section was supposed to show.

Host OS: Ubuntu 18.04 Docker: 19.03.5 Docker-compose: 1.24.0

I started lazydocker as docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock lazyteam/lazydocker, from the directory where my docker-compose.yml file is

if I run, in the same dir, docker-compose config, it works. Note that I do use a .env file for defining quite a few env vars that are mandatory for my docker-compose.yml

PS: thinking about this a bit more: how would lazydocker be able to run docker-compose (within its own container) and be able to find out my docker-compose config ? Do I have to mount the host folder with docker-compose config as volume into the lazydocker container ? Or is the 'project discovery' feature only working when lazydocker is not executed within its own container ?

gggeek commented 4 years ago

Answering to self: indeed it seems that mounting the host directory where the docker-compose.yml is located into the container where lazydocker runs can do the trick.

However, in order to achieve that, it is necessary to build a different container than the one currently available on dockerhub, as for best results it needs to have more tools installed (namely the docker executable and possibly a text editor)

jesseduffield commented 2 years ago

The latest dockerfile includes docker so I believe this can be closed off. Let me know if you're still having issues

danielsetreus commented 1 year ago

A little late to the game here, I admit it. But I've been trying to figure this out.

TLDR Running lazydocker inside a Docker container and trying to have it read docker-compose files is not possible when using the Docker image supplied by this repo. Perhaps building your own might work. I might investigate that...

Running the downloadable executable and pointing it to multiple compos files does work, but there is no way to start it with some custom config (suggestion to add that as a flag to the executable), so you won't be able to keep custom commands neatly packaged for your team.


Trying to run

docker run --rm -it \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v ${PWD}/config:/.config/jesseduffield/lazydocker \
    -v ./service1/:/s1 \
    -v ./service2/:/s2 \
    lazyteam/lazydocker

where ./config/config.yml is

commandTemplates:
  dockerCompose: docker-compose -f /s1/docker-compose.yml -f /s2/docker-compose.yml

But there are no services showing - and indeed I don't see how there would be since docker-compose is not installed in lazyteam/lazydocker. Also tried using compose as Docker plugin (i.e. docker compose -f ...), but the compose plugin is not installed either.

To further debug I even tried to make a custom command that would run docker-compose:

commandTemplates:
  dockerCompose: docker-compose -f /s1/docker-compose.yml -f /s2/docker-compose.yml
customCommands:
  containers:
    - name: Test DC config
      command: '{{ .DockerCompose }} config'
    - name: Test2 DC config
      command: 'docker-compose -f /s1/docker-compose.yml -f /s2/docker-compose.yml config'

First test indicates some other error with bracket replacements: exec: "{{": executable fild not found in $PATH

The second test hints to my docker-compose not being installed: exec: "docker-compose": executable fild not found in $PATH

Nxtmind commented 1 year ago

I am running lazydocker on my machine (not in docker), but I still had no services section when running from my project directory.

Turns out, docker-compose was missing from my system so I updated my lazydocker config YAML file to use docker compose instead of docker-compose

commandTemplates:
  dockerCompose: docker compose

My config.yml (go to Project > About and press 'o' in lazy docker) Hope this helps someone else!

bartekpacia commented 2 months ago

I just experienced this problem. It appeared out of nowhere, literally. I had services tab and then suddenly, I hadn't.

@Nxtmind's comment above fixed this. Thanks!