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

Error: failed to start containers: samba #7

Open
peter197321 opened this issue Aug 5, 2020 · 3 comments
Open

Error: failed to start containers: samba #7

peter197321 opened this issue Aug 5, 2020 · 3 comments

Comments

@peter197321
Copy link

I'm trying to create samba container on my windows10 host machine and running the command

`docker start samba`

it gives me an error:

(base) C:\>docker start samba
Error response from daemon: Ports are not available: listen tcp 0.0.0.0:445: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
Error: failed to start containers: samba

can you please point me where should I look at to solve this?

@rewitt1
Copy link
Collaborator

rewitt1 commented Aug 7, 2020

Hi @peter197321,

I looked into this a bit today. It seems that when using either Hyper-V or the WSL 2 version of Docker for Windows, it tries to directly listen on the same adapter as the host.(Previous versions evidently bridged instead) This is most likely what is causing the error, because Windows always grabs port 445 for the built-in file sharing.

My guess is that Virtual Box in Docker Toolbox wouldn't have this issue, but that's not an idea solution if you are able to run using Hyper-V or WSL 2.

I'm honestly not sure of the solution. I don't believe Windows Explorer will allow for specifying a different port, which would be the easiest thing. There may indeed be another way to address the issue, but I'm currently unaware of one.

@rewitt1
Copy link
Collaborator

rewitt1 commented Aug 7, 2020

Hello again @peter197321,

I did a bit more research, and if you are using WSL2 it seems there is no longer a need for the volume or for the samba container. While it will require some understanding of WSL2, I'll try to give an example. Ideally this will be added to the docs at some point.

Use explorer.exe to show files within the root filesystem inside WSL2

  1. Setup Docker for Windows using these instructions
    If you already have Docker for Windows installed you can follow the other steps to make sure it is using WSL2.
  2. Start powershell
  3. Start wsl by typing
    wsl
  4. Change to the home directory by typing
    cd
  5. Type the command below, which should open a directory in Windows explorer showing the files in the home directory. This is following the instructions described here.
    explorer.exe .

Now you should something like the following screenshot:
Explorer from WSL2

Setup and use Yocto

Note this is just an example, but should show the general flow.

  1. Change to the home directory in WSL2
    cd
  2. Create a directory for the poky source code and build output
    mkdir workdir
  3. Clone poky into the workdir
    git clone https://git.yoctoproject.org/git/poky workdir/poky
  4. Start crops/poky(after this you will be running from a shell inside the container)
    docker run --rm -it -v `pwd`/workdir:/workdir crops/poky --workdir=/workdir
  5. Source oe-init-build-env
    . ./poky/oe-init-build-env
  6. Use bitbake(in this example we build quilt-native
    bitbake quilt-native
  7. Now you should be able to change to the build directory in explorer to see the output. Example screenshot:
    After build

Disclaimer

Hopefully this is helpful. However, there may be issues with storage space/reclamation on WSL2 based on the comments here. With some investigation, my guess is you will be able to sort them out.

There may even be other issues I'm unaware of considering that I used WSL2 for the first time in order to write this post.

@ihatetoregister
Copy link

ihatetoregister commented Nov 12, 2021

I had a similar issue on macOS and my solution was to map to a different host port (446)
docker create -t -p 446:445 --name samba -v myvolume:/workdir crops/samba

And then connect to smb://localhost:446

Hopefully this works for you as well

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

No branches or pull requests

3 participants