rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.88k stars 275 forks source link

Cannot access mariadb container when created in rancher desktop, solved by rancher desktop reinstall? #5810

Open ahjulstad opened 11 months ago

ahjulstad commented 11 months ago

Actual Behavior

When using docker compose from rancher desktop, I cannot access the mariadb container from outside the host.

The identical docker-compose.yml works fine when started from docker desktop.

Steps to Reproduce

Docker compose:

# Use root/example as user/password credentials
version: '3.1'

services:

  ubuntu:
    image: ubuntu:latest
    restart: always
    command: sh -c "
      sleep infinity"

  db:
    image: lscr.io/linuxserver/mariadb:latest
    # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
    # (this is just an example, not intended to be a production configuration)
    # command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
    ports:
      - 23309:3306

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

docker compose up

I can connect to adminer, and also connect to the database from there (or the ubuntu image).

Uninstalling rancher desktop, and installing docker desktop, running docker compose up again, everything works like a charm.

Result

I am unable to connect to the database instance.

I can connect to adminer, and also connect to the database from there (or the ubuntu image).

Expected Behavior

A database client connecting to 23309 on my local host should see the database server.

Additional Information

If I uninstall rancher desktop and install docker desktop, everything works ok.

I have tested similar setup to this with postgresql, and that works fine in both docker desktop and rancher desktop.

It doesn't seem like mariadb wants to start listening to the correct ports in the network environment provided.

This could easily be a bug outside of rancher desktop, but since I have banged my head at this problem for some hours now, and ended up fixing it by uninstalling rancher desktop, I thought I could let you know.

Then I uninstalled and reinstalled rancher desktop, and now it works. I have no idea why.

Rancher Desktop Version

1.10.0

Rancher Desktop K8s Version

1.28.2

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Win 11 Pro 22621.2428

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No.

ahjulstad commented 11 months ago

Again, unable to reproduce at the moment.. but this was very strange, it only affected mysql and mariadb, while postgresql and mssql worked fine. Mariadb worked in docker desktop, and then I reinstalled rancher desktop and now it works...