Docker Linux vs Windows port not publishing

Hello, Docker beginner here. I am trying to understand the differences of what it takes to get Docker working in these two separate environments.

I am trying to publish port 3306:3306 for mariadb in the screenshot below, but the port is always BLANK/EMPTY after I run the container, on Windows only. I’ve tested this on a linux machine (to make sure that it’s really just Windows) and it DOES work there.

The status of the Ports on Windows is always “Exited”, too. What do I need to do on Windows specifically to get this working please?

The STATUS you’re seeing is the container’s status, it started and then exited immediately for some reason.

User ‘docker logs container-name’ to see the containers console output and figure out why it couldn’t start properly. Maybe the volume you’re mapping already contains a database that can’t be imported?

Hi klypnick!

I ran “docker logs container-name” and got this message:

Searching around for solutions to this error message but no luck yet.

Regarding your question about a database that can’t be imported, I am actually trying to create a fresh new db with mariadb in a container so there shouldn’t be any protections on it. This is the same exact routine I used on a linux machine and it worked, just not on my Windows desktop.

Use the Docker Log command to see why it failed.
Since you used the command, it says that your innoDb file is 0 length, and expected 768. So the folder in which innoDb resides needs permission to write. Since the program failed to run, the port was not assigned and shows as a blank.

I’m not sure what your running, in terms of Windows version of MySQL or the Linux version. But if your running on a Linux Production server such as Ubuntu, then you need to tell Docker for Windows to use Linux containers, and load a Linux version of MySQL in the container. You can peek inside the container to look at the file structure using Docker exec something and confirm the file permission error.

I personally run a Linux version of MongoDB on my Docker for Windows on my Win 10 workstation. I used a pre-made repository of MongoDB I got from Docker, and created a Docker Compose file to program MongoDB on startup. A pre-made repository will contain a light-weight version of Linux to run MySQL server in a it’s own OS within the container.

1 Like

Figured it out, thanks jkirkerx.

I used Windows 10 for the Windows issue I had and an AWS server for the linux enviroment where it ran successful.

So I checked permissions during my previous tests (as well as today) and saw that my user account “DID have access to the proper folders” as I thought. HOWEVER, I took it a step further since you were certain it was a permissions write error and looked up other articles, then found this one:

This article said that I should make sure my user is added to the “docker-users” group in Windows BUT ALSO add myself to the the Hyper-V administrators group in Windows. I did this and it did not work, UNTIL I RESTARTED MY MACHINE.

So thank you for helping give me that extra push to find out where else I could set permissions. It works now!