intellij-ideadocker-compose

Update docker compose command to run in IntelliJ


I've create a new docker compose running configuration in intelliJ Community 2023.2.3 to run it just on pressing a button in Ubuntu 22.043 LTS.

configuration settings

But the comand the InteLLiJ runs is /usr/bin/docker compose -f /home/myuser/Projects/project-bin/docker-compose.yml -p airc-training --compatibility up backend postgres

I got the following message error:

unknown shorthand flag: 'f' in -f See 'docker --help'.

That's because the system cannot understand docker compose command. Only docker-compose

I tried to define an alias on .barshrc alias docker compose="docker-compose" without success. It works on command line but I still got the same error.

I look into the Jetbrains website but they don't have any specs about that.

I think that if IntelliJ runs /usr/bin/docker-compose -f /home/myuser/Projects/project-bin/docker-compose.yml -p airc-training --compatibility up backend postgres the problem is solved but there are no options for that.

enter image description here

In docker website says that docker-compose is the default command for linux.

I was able to create Shell scripts configurations that up and restart the containers. They work, but they don't show me the logs. And I need to insert the proper command to display them.

I want to avoid that and keep the usability just like a java application, where I run it and automatically can access to logs on run/debug window.

How can I make this work?


Solution

  • I have found a partial solution:

    As y.bedrov said I had to go to

    Settings | Build, Execution, Deployment | Docker | Tools

    Docker tools

    The docker compose executable, by default is: /usr/bin/docker. But if you using docker-compose instead of docker compose it won't work.

    The result is like this: docker-compose set

    However, it's not possible to see if the containers are up or put them down by configuration, as with every application.

    But is it possible to do that in the Services window (ALT + 8), and see all logs or logs for each container separately as well.

    stop, see, restart, logs