MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to Installing Rancher on a Single Node Using Docker

This guide covers installing Rancher on a single Linux host with one docker run command. It walks through all four TLS options: Rancher's built-in self-signed certificate, your own self-signed certificate, a CA-signed certificate and Let's Encrypt. It also fills in what the steps above leave out: installing Docker, keeping data persistent, getting the bootstrap password, checking that the install worked, upgrading and fixing common errors.


Step 1 – Install Docker

Step 2 – Choose an SSL Option and Install Rancher

Choose from the following options:

  • Option A: Default Rancher-generated Self-signed Certificate
  • Option B: Bring Your Own Certificate, Self-signed
  • Option C: Bring Your Own Certificate, Signed by a Recognized CA
  • Option D: Letโ€™s Encrypt Certificate

Step 3 – Option A: Default Rancher-generated Self-signed Certificate


docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  --privileged \
  rancher/rancher:latest

Reference:


When a single-node Docker install makes sense

Running Rancher as one Docker container is the fastest way to get the Rancher UI and API up. It suits labs, demos, training and short-lived test environments. The container runs an embedded lightweight Kubernetes (K3s) internally, so it needs the --privileged flag.

Note: Rancher does not recommend the Docker install for production. There is no high availability, and you cannot move a Docker install onto a Kubernetes cluster later. For production, install Rancher with Helm on a dedicated Kubernetes cluster (K3s or RKE2) with at least three nodes.

Prerequisites

  • A 64-bit Linux host (VM or bare metal). Plan for at least 2 vCPUs and 4 GB of RAM. Rancher becomes slow or unstable with less.
  • A Docker Engine version listed as supported in the support matrix for the Rancher version you plan to run.
  • Inbound TCP ports 80 and 443 open to your browser, and to any downstream cluster nodes that will register with Rancher.
  • A DNS name for the host. Options C and D need one. It is also recommended for A and B, because downstream clusters store the Rancher server URL.
  • Do not run Rancher on a host that is also a node of a cluster Rancher manages.

Step 1 in detail: install Docker

Step 1 above has no commands. On most distributions, Docker's convenience script installs Docker Engine. In production-like environments, use your distribution's packages or Docker's official repository, and pin a version that Rancher supports.

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo systemctl enable --now docker

# Optional: run docker without sudo (log out and back in afterwards)
sudo usermod -aG docker $USER

# Verify
docker version
docker run --rm hello-worldCode language: PHP (php)

Corrected and complete install commands for all four SSL options

The example above shows only Option A, and it stores Rancher's data inside the container. If you remove that container, you lose every user, cluster registration and setting. Each command below adds three things: --name rancher so the container is easy to manage, a bind mount -v /opt/rancher:/var/lib/rancher so data survives container replacement, and a pinned image tag instead of latest. Replace v2.X.Y with the exact release you have chosen from the Rancher releases page.

Option A: Rancher-generated self-signed certificate. Use this for quick labs. Browsers will show a certificate warning.

docker run -d --restart=unless-stopped \
  --name rancher \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  --privileged \
  rancher/rancher:v2.X.YCode language: JavaScript (javascript)

Option B: your own self-signed certificate. Mount the full-chain certificate, the private key and the CA certificate that signed them. All three must be PEM-encoded.

docker run -d --restart=unless-stopped \
  --name rancher \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  -v /etc/rancher-certs/fullchain.pem:/etc/rancher/ssl/cert.pem \
  -v /etc/rancher-certs/privkey.pem:/etc/rancher/ssl/key.pem \
  -v /etc/rancher-certs/ca.pem:/etc/rancher/ssl/cacerts.pem \
  --privileged \
  rancher/rancher:v2.X.YCode language: JavaScript (javascript)

Option C: certificate signed by a recognized CA. Mount the certificate and key, and pass --no-cacerts after the image name so Rancher does not generate its own CA. The certificate file should contain the full chain, including intermediates.

docker run -d --restart=unless-stopped \
  --name rancher \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  -v /etc/rancher-certs/fullchain.pem:/etc/rancher/ssl/cert.pem \
  -v /etc/rancher-certs/privkey.pem:/etc/rancher/ssl/key.pem \
  --privileged \
  rancher/rancher:v2.X.Y \
  --no-cacertsCode language: JavaScript (javascript)

Option D: Let's Encrypt. Pass --acme-domain with a public DNS name that resolves to this host. Port 80 must be reachable from the internet, because Let's Encrypt validates over HTTP. Do not remap port 80 to another port with this option.

docker run -d --restart=unless-stopped \
  --name rancher \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  --privileged \
  rancher/rancher:v2.X.Y \
  --acme-domain rancher.example.comCode language: JavaScript (javascript)
Flag or argumentPurpose
--restart=unless-stoppedStarts Rancher again after a reboot or crash unless you stopped it yourself
-p 80:80 -p 443:443Publishes HTTP (redirects to HTTPS) and HTTPS on the host
-v /opt/rancher:/var/lib/rancherKeeps Rancher's embedded datastore on the host so it survives container replacement
--privilegedRequired because Rancher runs embedded K3s inside the container
--no-cacertsOption C only: tells Rancher the certificate comes from a public CA
--acme-domainOption D only: requests and renews a Let's Encrypt certificate for that name

Note: To set the first admin password yourself instead of using a generated one, add -e CATTLE_BOOTSTRAP_PASSWORD='YourStrongPassword' before the image name.

Log in for the first time

Rancher takes a minute or two to start. Since Rancher 2.6, a random bootstrap password is generated on first start and written to the container log. The steps above do not mention this, but you need it to log in.

  1. Follow the logs until startup settles: docker logs -f rancher
  2. Get the bootstrap password: docker logs rancher 2>&1 | grep "Bootstrap Password:"
  3. Open https://<your-host-or-dns-name> in a browser. With Options A and B, accept the certificate warning.
  4. Enter the bootstrap password, set a strong admin password, and confirm the Server URL. Downstream cluster nodes use this URL to reach Rancher, so it must be a stable name or IP they can resolve and reach.
# Quick health checks
docker ps --filter name=rancher
curl -k https://localhost/ping
# Expected output:
# pongCode language: PHP (php)

Common errors and fixes

SymptomLikely causeFix
bind: address already in use on port 80 or 443Another web server (Nginx, Apache, Traefik) already owns the portStop that service, or publish different ports such as -p 8080:80 -p 8443:443 and browse to https://host:8443. This does not work with Option D.
Container restarts repeatedly and the logs mention privileged mode--privileged was omittedRemove the container and run it again with --privileged
Container restarts and the logs show K3s or cgroup errorsHost kernel, cgroup or Docker version not supported by this Rancher releaseCheck the support matrix and use a supported OS, Docker and Rancher combination
Let's Encrypt certificate never issuesDNS does not point to the host, or port 80 is blocked from the internetCheck with dig rancher.example.com and open port 80 in firewalls and security groups
Browser warns about the certificate with Option CIntermediate certificates are missing from cert.pemConcatenate the server certificate and intermediates into one full-chain file
All settings lost after recreating the containerNo volume was mounted for /var/lib/rancherAlways mount a host path or named volume, as shown above
grep finds no bootstrap passwordStartup has not finished, or the data directory already contains an initialized installWait and check the logs again. If the data directory is reused, log in with the existing admin password.

Upgrading and backing up

With data in /opt/rancher, an upgrade means stopping the old container, backing up the directory and starting a newer image against the same data. Upgrade one supported minor version at a time and read the release notes first. Rolling back means restoring the backup; you cannot simply start an older image against upgraded data.

docker stop rancher
sudo tar czf /root/rancher-backup-$(date +%F).tar.gz -C /opt rancher
docker rm rancher

docker pull rancher/rancher:v2.X.Z
docker run -d --restart=unless-stopped \
  --name rancher \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  --privileged \
  rancher/rancher:v2.X.ZCode language: JavaScript (javascript)

Note: Include the same certificate mounts and arguments (--no-cacerts or --acme-domain) in the new docker run that you used originally.

Security best practices

  • Pin an exact image tag. latest can pull a new minor version on the next restart or recreate and trigger an untested upgrade.
  • Limit access to port 443 with firewall rules or security groups. A privileged container is effectively root on the host.
  • Use Option C or D for anything other people will use, so users do not learn to click through certificate warnings.
  • Change the bootstrap password immediately, and set up an external identity provider (LDAP, SAML or OIDC) instead of sharing the local admin account.
  • Protect /opt/rancher and your certificate files with root-only permissions, and back them up regularly.

Frequently asked questions

Why does Rancher need the –privileged flag in Docker?

Since Rancher 2.5, the container runs an embedded K3s Kubernetes cluster to host Rancher itself. K3s needs privileged access to manage cgroups, networking and mounts, so the container will not start correctly without the flag.

How do I find the Rancher bootstrap password?

Run docker logs <container> 2>&1 | grep "Bootstrap Password:" after the container has started. You can also set the password in advance with -e CATTLE_BOOTSTRAP_PASSWORD=... in the docker run command.

Can I run Rancher on ports other than 80 and 443?

Yes. Publish other host ports, for example -p 8080:80 -p 8443:443, and browse to the HTTPS port you chose. This does not work with the Let's Encrypt option, because HTTP validation needs port 80.

Is a single-node Docker install of Rancher suitable for production?

No. It has no high availability, and it cannot be migrated to a Kubernetes-based install. For production, install Rancher with Helm on a multi-node K3s or RKE2 cluster.

How do I keep Rancher data when the container is removed?

Mount /var/lib/rancher to a host directory or named volume, for example -v /opt/rancher:/var/lib/rancher. Without the mount, the data lives only in the container's writable layer and is deleted along with the container.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals

Related Posts

GitLab Tutorials: Using letsencrypt with Gitlab self hosted server

A self-managed GitLab server installed with the Linux (Omnibus) package can get and renew free TLS certificates from Let's Encrypt by itself. You point a public DNS…

Read More

The Ultimate Guide to Uptime, Health, Synthetic and Infrastructure Monitoring: A Complete Taxonomy

Instead of categorizing by vendor or product, we should categorize by what is monitored, how it is monitored, and what failures can be detected. For example, UptimeRobot,…

Read More

How to generate Letsencrypt certificates with Verifying domain using API

acme.sh can get a Let's Encrypt certificate by proving you control a domain through your DNS provider's API. It creates a temporary TXT record, so you never…

Read More

Cert Manager: Generate TLS Certificates Using Self Signed Issuers

This page shows how to use cert-manager to create a private certificate authority (CA) from a self-signed issuer, then use that CA to issue TLS certificates for…

Read More

Top 10 Kubernetes Management Tools in 2026: K9s vs Headlamp vs Lens vs Rancher

A Complete Guide for DevOps Engineers, SREs, Platform Engineers and Kubernetes Administrators Kubernetes has become the foundation of modern cloud-native infrastructure. From startups running a handful of…

Read More

Install Rancher RKE2 Cluster three nodes manually

This guide shows how to build a highly available, three-node Rancher RKE2 Kubernetes cluster by hand. All three servers run the control plane and embedded etcd. The…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x