middleware icon indicating copy to clipboard operation
middleware copied to clipboard

dev.sh not working properly when using latest version of docker

Open sidtohan opened this issue 1 year ago • 6 comments

Description:

Unable to run the dev.sh script. It gives an error in the docker-compose.yml file as well as an issue with the "watch" command.

Steps to reproduce:

  1. Start docker using docker desktop (currently using version 4.30.0-amd64)
  2. Go to the root path of the repository and run dev.sh using ./dev.sh

Expected behavior:

dev.sh should start the application with the development environment.

Actual behavior:

image

Server Setup Information:

  • Operating System: Pop!_OS 22.04 LTS
  • Deployment Method: docker

Additional context

I came across this discussion on stack overflow. Maybe the current code uses an older version of docker compose?

Also, found this in the cli/source/app.tsx file:

image

sidtohan avatar May 22 '24 16:05 sidtohan

Hey @sidtohan! 👋🏽 We'd be happy to help you with this. Could you share the output of docker version with us?

Generally this issue was solved by simply asking people to update to the latest version of docker in the past. But you're mentioning you're already on the latest version.

However, you also mentioned that you're on Pop!_OS 22.04 LTS which might simply not have a build for the version of docker that contains the watch command yet, making the latest version be not the actually latest release of docker.

For reference: The latest docker version listed online appears to be 24.0.9

jayantbh avatar May 23 '24 07:05 jayantbh

image

Here is the output for docker version command.

sidtohan avatar May 23 '24 07:05 sidtohan

Thanks @sidtohan for submitting the issue. The problem seems to be related to the version of docker installed. It is actually better if we move to using docker compose instead of docker-compose as the docker-compose project has probably stopped receiving updates.

We could make the changes so that even older versions of docker and docker-compose is supported.

The differences between docker-compose and docker compose can be found here

adnanhashmi09 avatar May 23 '24 07:05 adnanhashmi09

I also think this is a good point to make some prerequisite checks before starting the container for development. This way we could provide better troubleshooting experience for the user. the prerequisite checks could include:

  • Check if the correct version of docker is installed.
  • Check if watch command is compatible
  • Check if the docker-compose.yml file is present
  • Check if ports specified are available to be used
  • Check if another instance of watch is running. (exit that process and start it using the cli)

We should make a separate issue for that. @jayantbh what are your thoughts?

adnanhashmi09 avatar May 23 '24 07:05 adnanhashmi09

Yea, a checklist that is part of the dev.sh script might work well to prevent similar issues.

Also, previously I had mentioned that the latest version is 24.0.7. My bad, the latest is actually 26.1.3, and @sidtohan's version appears to be pretty close to that.

Perhaps as a fix to this at the moment, we should change the command from docker-compose to docker compose instead.

Think that'll work? @adnanhashmi09 @sidtohan

jayantbh avatar May 23 '24 08:05 jayantbh

Yea, a checklist that is part of the dev.sh script might work well to prevent similar issues.

Also, previously I had mentioned that the latest version is 24.0.7. My bad, the latest is actually 26.1.3, and @sidtohan's version appears to be pretty close to that.

Perhaps as a fix to this at the moment, we should change the command from docker-compose to docker compose instead.

Think that'll work? @adnanhashmi09 @sidtohan

Yes that should work as a quick fix. But a better way would be to first run docker compose watch and if it fails then try docker-compose watch. If both fail, we throw an error. For the sake of backwards compatibility.

adnanhashmi09 avatar May 23 '24 08:05 adnanhashmi09

@sidtohan just following up. Were you able to move past this?

jayantbh avatar Jun 03 '24 04:06 jayantbh

Hey @jayantbh , still facing the same issue. I tried replacing the docker-compose commands in app.tsx with docker compose. However, I'm facing this issue now.

image

sidtohan avatar Jun 10 '24 09:06 sidtohan

@sidtohan What changes did you make? I don't think you are using the spawn command correctly. Please refer to the nodejs docs. For some reference you are supposed to use the runCommand function like this:

const commandResponse = runCommand(
  'docker',
  ['compose', 'watch'],
  runCommandOpts
);

adnanhashmi09 avatar Jun 10 '24 10:06 adnanhashmi09

@sidtohan What changes did you make? I don't think you are using the spawn command correctly. Please refer to the nodejs docs. For some reference you are supposed to use the runCommand function like this:

const commandResponse = runCommand(
  'docker',
  ['compose', 'watch'],
  runCommandOpts
);

Yes, you are right @adnanhashmi09, my bad. I have used it properly now, and the error doesn't occur anymore. image

Can this issue be assigned to me please? I would like to implement the proper fix as suggested above(running docker compose first and then reverting to docker-compose should it fail)

sidtohan avatar Jun 10 '24 11:06 sidtohan

@sidtohan done!

samad-yar-khan avatar Jun 10 '24 12:06 samad-yar-khan

Closing this, as this was fixed in #431

adnanhashmi09 avatar Jun 24 '24 08:06 adnanhashmi09