Skip to content

Run Shiny on localhost

Knut Ole Sjøli edited this page Dec 5, 2019 · 2 revisions

Start Shiny on localhost

# pull image
docker pull mapic/shiny-server:latest

# start shiny
docker run -it -p 3838:3838 -v /your/local/shiny-app/folder/:/srv/shiny-server/apps -v /your/local/shiny-server.conf:/etc/shiny-server/shiny-server.conf mapic/shiny-server

Then open browser to http://localhost:3838/

Configs

/your/local/shiny-app/folder/ = a folder with R apps in it on your localhost machine

Default, working shiny-server.conf:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# disable websockets
# disable_websockets true;

# Define a server 
server {

  # that listens on port 3838
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server/apps;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server/;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index off;

    # Increased Idle timeout
    app_idle_timeout 0;

  }
}

Clone this wiki locally