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

Warn users about running commands in rancher-desktop distro #8332

Open
rklec opened this issue Mar 5, 2025 · 5 comments
Open

Warn users about running commands in rancher-desktop distro #8332

rklec opened this issue Mar 5, 2025 · 5 comments
Labels
area/wsl WSL integration kind/enhancement New feature or request platform/windows
Milestone

Comments

@rklec
Copy link

rklec commented Mar 5, 2025

Actual Behavior

If I create a simple compose.yml and try to start with with docker compose up.

Steps to Reproduce

  1. Create:
services:
  test:
    image: hello-world
  1. Run docker compose up -d in the Ranchor-Desktop WSL (wsl -d rancher-desktop).
    Also try docker compose version

Result

$ docker compose version
docker: 'compose' is not a docker command.
See 'docker --help'
$ docker compose up -d
unknown shorthand flag: 'd' in -d
See 'docker --help'.

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
  run         Create and run a new container from an image
  exec        Execute a command in a running container
  ps          List containers
  build       Build an image from a Dockerfile
  pull        Download an image from a registry
  push        Upload an image to a registry
  images      List images
  login       Log in to a registry
  logout      Log out from a registry
  search      Search Docker Hub for images
  version     Show the Docker version information
  info        Display system-wide information

Management Commands:
  builder     Manage builds
  buildx*     Docker Buildx
  container   Manage containers
  context     Manage contexts
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  plugin      Manage plugins
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Swarm Commands:
  swarm       Manage Swarm

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  wait        Block until one or more containers stop, then print their exit codes

Global Options:
      --config string      Location of client config files (default "/root/.docker")
  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket to connect to
  -l, --log-level string   Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Run 'docker COMMAND --help' for more information on a command.

For more help on how to use Docker, head to https://docs.docker.com/go/guides/

Similar output happens, when you use -f to specify the Dockerfile explicitly.

It seems for some reason docker compose (v2) is not installed?

Running docker-compose works BTW, so v1 seems to be installed, but well...

Expected Behavior

https://docs.rancherdesktop.io/tutorials/working-with-containers/#docker-compose documents that exact use case and implies I can thus use docker compose (respectively it is installed).

This unofficial blog, also implies it is installed:

Since the Rancher Desktop 1.1 release, these steps are no longer necessary for installation of Docker Compose, it is now automatic.

Additional Information

docker.log

extensions.log

wsl-helper.log
wsl-helper.Ubuntu.log

wsl.log

Rancher Desktop Version

1.18.0

Rancher Desktop K8s Version

N/A

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Windows 10 Home version 22H2 (Build 19045.5371)

What CPU architecture are you using?

x64

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

None

Windows User Only

Yes, some VPN, but that should be unrelated.

@rklec rklec added the kind/bug Something isn't working label Mar 5, 2025
@mook-as
Copy link
Contributor

mook-as commented Mar 5, 2025

The rancher-desktop distribution (as well as rancher-desktop-data) is not meant to be used directly; we do not install the tools in there (as it would interfere with internal operations).

If you wish to run docker compose withing WSL, please do so from a different distribution that you have installed separately.

@jandubois jandubois added the triage/close-candidate Can this be closed? label Mar 5, 2025
@rklec
Copy link
Author

rklec commented Mar 7, 2025

Ah okay, so where are the tools installed and what should I use instead?
I mean the Rancher doc states I can use docker-compose (somehow?).

I mean I also have WSL integration enabled for "my own" distro:
Image

There docker compose up works indeed (for some reason docker compose --version does not, but may I just messed up the syntax.
Is this the intended use case aka enabling integration and then Rancher installs docker compose there? Because I don't know whether I installed docker compose by myself there or whether it was rancher.

Then maybe this is s doc problem, because the linked doc does not state how/in which distro or so I should run this. And I assumed (and for all previous tasks it worked) that using rancher-desktop was the intended way.

@jandubois
Copy link
Member

There docker compose up works indeed (for some reason docker compose --version does not, but may I just messed up the syntax.

The command is docker compose version.

Is this the intended use case aka enabling integration and then Rancher installs docker compose there? Because I don't know whether I installed docker compose by myself there or whether it was rancher.

Yes, this is indeed how it works. Rancher Desktop will add the path to the cli-plugins directory in the ~/.docker/config.json file, so docker will load them from there.

@jandubois
Copy link
Member

I think we should display a message in /root/.profile when an interactive shell is launched in the rancher-desktop distro (maybe with some bright colours to make it noticeable):

C:\Users\SUSE>wsl -d rancher-desktop
The rancher-desktop distro is not meant to be used to run any application.
Please enable WSL integration in the Preferences to make all tools available
in your own distro!
/mnt/c/Users/SUSE #

It does not display when you run rdctl shell:

C:\Users\SUSE>rdctl shell
/mnt/c/Users/SUSE #

For rancher-desktop-data there is no need to do anything because the distro does not contain any binaries beyond the required /bin/sh, so there is nothing you can do inside it anyways.

@jandubois jandubois added kind/enhancement New feature or request platform/windows area/wsl WSL integration and removed kind/bug Something isn't working triage/close-candidate Can this be closed? labels Mar 7, 2025
@jandubois jandubois added this to the 1.19 milestone Mar 7, 2025
@jandubois jandubois changed the title docker compose error: "unknown shorthand flag: 'f' in -f" or "'d' in -d" / Docker compose v2 not installed? Warn users about running commands in rancher-desktop distro Mar 7, 2025
@jandubois
Copy link
Member

We can add exit to the end of .profile so the user is kicked out again. If you really have to create a shell you can always add sh as the argument:

C:\Users\SUSE>wsl -d rancher-desktop
The rancher-desktop distro is not meant to be used to run any application.
Please enable WSL integration in the Preferences to make all tools available
in your own distro!

C:\Users\SUSE>wsl -d rancher-desktop sh
/mnt/c/Users/SUSE #

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/wsl WSL integration kind/enhancement New feature or request platform/windows
Projects
None yet
Development

No branches or pull requests

3 participants