Skip to content
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

sail up -d creates new docker container instead of using correct one #690

Open
MrLarkyy opened this issue May 4, 2024 · 9 comments
Open

Comments

@MrLarkyy
Copy link

MrLarkyy commented May 4, 2024

Sail Version

1.29.1

Laravel Version

11.0.0

PHP Version

8.3.6

Operating System

Windows (WSL)

OS Version

23H2

Description

Hey I'm experiencing this issue whenever I run sail up -d I notice it creates a new docker container instead of using the previous already made one. This is occurring on a freshly installed Laravel application.
I followed the Sail documentation for windows

Steps To Reproduce

follow the documentation
Then:

  • run the project with sail
  • stop the project
  • rerun the project with sail
  • now there should be an extra docker container made.
@pb30
Copy link

pb30 commented May 4, 2024

What exact commands are you running to reproduce this?

@TwqntysJr
Copy link

I'm experiencing the same issue exactly like described

The new instance of the docker containers are created when I run
./vendor/bin/sail up -d

@pb30
Copy link

pb30 commented May 4, 2024

How are you stopping the project? Is this on a fresh project with unmodified docker-compose?

@MrLarkyy
Copy link
Author

MrLarkyy commented May 6, 2024

Hey! It is a fresh project. Ive tried to make multiple of the projects, it always happens. Only thing that I use is the sail up -d command

@MrLarkyy
Copy link
Author

MrLarkyy commented May 6, 2024

image
It always creates a new container with random UUID.

image

Here you can see that it even shows the UUID in the console.

Copy link

github-actions bot commented May 7, 2024

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@Jubeki
Copy link
Contributor

Jubeki commented May 8, 2024

Does WSL show a different folder name each time you start WSL?
Because the container name is determined from the current folder you are in.

Maybe there is a way to set the container name via an .env entry. Probably needs a PR to sail.

@MrLarkyy
Copy link
Author

MrLarkyy commented May 8, 2024

The thing is that it did work at the first time. I've called my project testapp and even in wsl was testapp shown as well as in my docker. Another thing is that sometimes it works and sometimes it just creates a completely new container with random name as you can see on the screenshots. It is really strange.

@Jubeki
Copy link
Contributor

Jubeki commented May 8, 2024

So the problem itself does not lie with Sail but with Docker / WSL:
https://docs.docker.com/compose/project-name/

You can attempt a PR where the project-name is defined in .env and added to the docker compose command. If no .env variable is defined the project folder should be used.

Why WSL sometimes mounts another random folder name instead of the correct name is not clear to me. Maybe try a bug report in WSL: https://github.com/microsoft/WSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants