rocker-org / devcontainer-features

A collection of Dev Container Features.
https://rocker-project.org/images/devcontainer/features.html
MIT License
52 stars 16 forks source link

runing rserver fails with "localhost redirected you too many times" #235

Closed AmelZulji closed 4 months ago

AmelZulji commented 4 months ago

When i try to run the server using rserver I get in google chrome:

This page isn’t working
localhost redirected you too many times.

I tried deleting cookies and all possible solution but doesnt work. The docker container is running normaly, but just cant run rserver. Can you please help.

Here my .devcontainer.json:

{
    "name": "docker for sc",
    "build": {
        // Path is relative to the devcontainer.json file.
        "dockerfile": "Dockerfile"
    },

    "features": {
        "ghcr.io/rocker-org/devcontainer-features/rstudio-server:0": {}
    }
}

here the dockerfile:


FROM rocker/r-ver:4.2.3

Thank you!

AmelZulji commented 4 months ago

@rokroskar, @eitsupi would you have any suggestion for this? it is seems it is related to the things you were discussing in #172.

Very much looking forward to your help

eitsupi commented 4 months ago

I don't usually use this Feature, so there's nothing I can say. I suspect that you do not fully understand container port forwarding.

Why not try https://github.com/rocker-org/devcontainer-try-r?

AmelZulji commented 4 months ago

The idea is to have minimal r-ver image to go in production. rstudio-server feature is convenient to have on top of the base image for development.

But thank you for your time.

eitsupi commented 4 months ago

It is recommended that, at a minimum, a non-root user be created by using ghcr.io/devcontainers/features/common-utils.

rokroskar commented 4 months ago

@AmelZulji what are you trying to accomplish? Why don't you just use the rocker/rstudio image since you are starting from the rocker stack anyway?

AmelZulji commented 4 months ago

Thank you for looking into this, guys!

@rokroskar I want to build as minimal image as possible starting from rocker/r-ver. The image will be used on HPC (i have no root) with singularity. The reason I didnt start with rocker/rstudio was to spare ~250MB (difference between r-ver and rstudio images). I was hopping to use rstudio-server on top of my r-ver image for local development.

@eitsupi adding ghcr.io/devcontainers/features/common-utils removes redirection problem but now following error appears:

Screenshot 2024-07-12 at 14 33 14

This is the .devcontainer.json from which im spinning up devcontainer:

{
    "name": "scenv",
    "image": "rocker/r-ver:4.2.3",
    "features": {
      "ghcr.io/rocker-org/devcontainer-features/rstudio-server:0": {},
      "ghcr.io/devcontainers/features/common-utils": {}
    },
    "postAttachCommand": {
        "rstudio-start": "rserver"
    },
    "forwardPorts": [
        8787
    ],
    "portsAttributes": {
        "8787": {
            "label": "RStudio IDE"
        }
    }
  }
eitsupi commented 4 months ago

@AmelZulji Just to be sure, are you using anything like arm64 mac's amd64 emulation?

AmelZulji commented 4 months ago

No, im on amd64

eitsupi commented 4 months ago

Hmmm, I can't think of any other reason. Anyway, RStudio Server has not been tested on CI, so there is no way to verify that it works (and I have no motivation since I don't use RStudio).

AmelZulji commented 4 months ago

I see. Do you have any recommendation for my use case. What do you use instead of Rstudio? Perhaps Reditorsupport in Vscode?

eitsupi commented 4 months ago

@AmelZulji I have never used singularity so I cannot advise. I suggest you ask questions on Stack Overflow, etc.

I ran the example of combining rig and RStudio in https://github.com/rocker-org/devcontainer-try-r on GitHub Codespaces and confirmed that RStudio Server works correctly. If you run this locally you can see if there is a problem with your setup.

image image

AmelZulji commented 4 months ago

thank you @eitsupi. I will keep it open to see whether @rokroskar has to add something.

eitsupi commented 4 months ago

Close this as I have verified that the recommended use is fine.

If you are not an expert, I recommend that you use the recommended way and do not deviate from it (or at least do your own troubleshooting if you do deviate).