Rancher server restart loop


#1

I’m trying to evaluate Rancher 2.1.5 and I’ve hit a snag. I’m using ESXi 6.7 as a platform, and I’ve created a server running RancherOS. After that, I SSH in and run sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest -v /opt/rancher:/var/lib/rancher

That appears to work okay, however, a docker ps shows this:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f7076c909706 rancher/rancher:latest "entrypoint.sh -v /o…" 35 seconds ago Restarting (0) 1 second ago awesome_wright

And looking at the logs for the container shows this:

rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5
rancher version v2.1.5

Running without the -v argument works properly. How can I fix this and get the server to start properly while keeping the data persistent?


#2

My guess is that /opt/rancher does not exist? You may need to manually create the rancher directory in opt


#3

I am in the same case, started using:

sudo docker run -p 80:80 -p 443:443 rancher/rancher:latest -v /opt/rancher:/var/lib/rancher
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                          PORTS               NAMES
4e196451d962        rancher/rancher:latest   "entrypoint.sh -v /o…"   39 minutes ago      Restarting (0) 18 seconds ago                       xenodochial_northcutt

Docker

root@debian-2gb-nbg1-1 /opt # docker version
Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:34:04 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false

#1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07)

root@debian-2gb-nbg1-1 /opt/rancher # ls -al
total 8
drwxr-xr-x 2 root root 4096 Mar  4 20:38 .
drwxr-xr-x 4 root root 4096 Mar  4 21:10 ..

#4

I suspect my machine to be running already in a docker.
[edit] … after checking, it seems it is not the case. Any idea?


#5

@Crackerjam did you find a solution?

Here is my logs
root @ debian-2gb-nbg1-1 ~ # docker run -p 80:80 -p 443:443 rancher/rancher:latest -v /opt/rancher:/var/lib/rancher

Unable to find image 'rancher/rancher:latest' locally

latest: Pulling from rancher/rancher

6cf436f81810: Pull complete 

987088a85b96: Pull complete 

b4624b3efe06: Pull complete 

d42beb8ded59: Pull complete 

20428076f45c: Pull complete 

aa5f6ec4068f: Pull complete 

fa0b81e2aefe: Pull complete 

174adca119fa: Pull complete 

b36e95625791: Pull complete 

3b4599da8bc5: Pull complete 

7c3eae4ec924: Pull complete 

821c0eae95fd: Pull complete 

Digest: sha256:1943e9b7d802992d3c61184af7ae2ca5d414c15152bc40ec995e71e28cb80844

Status: Downloaded newer image for rancher/rancher:latest

2019-03-06T22:04:15.579582150+01:00 image pull rancher/rancher:latest (name=rancher/rancher, org.label-schema.build-date=2019-03-06T18:22:27Z, org.label-schema.schema-version=1.0, org.label-schema.vcs-ref=6472ba0c03ff7a222f5891ce5272e2e4261d8f58, org.label-schema.vcs-url=https://github.com/rancher/rancher.git)

2019-03-06T22:04:15.618612804+01:00 volume create e060d957c24b8690cf2fa49934d06c361190fed8d2a495a38dd896e6b83d5fb8 (driver=local)

2019-03-06T22:04:15.620513442+01:00 volume create a0934fe71a154a4ed955a9bda0fbc0045218034517b7214dfcc058e074480c5c (driver=local)

2019-03-06T22:04:15.631067770+01:00 container create 8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98 (image=rancher/rancher:latest, name=admiring_chaum, org.label-schema.build-date=2019-03-06T18:22:27Z, org.label-schema.schema-version=1.0, org.label-schema.vcs-ref=6472ba0c03ff7a222f5891ce5272e2e4261d8f58, org.label-schema.vcs-url=https://github.com/rancher/rancher.git)

2019-03-06T22:04:15.635846949+01:00 container attach 8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98 (image=rancher/rancher:latest, name=admiring_chaum, org.label-schema.build-date=2019-03-06T18:22:27Z, org.label-schema.schema-version=1.0, org.label-schema.vcs-ref=6472ba0c03ff7a222f5891ce5272e2e4261d8f58, org.label-schema.vcs-url=https://github.com/rancher/rancher.git)

2019-03-06T22:04:15.717222937+01:00 network connect 80a31acde66e6d0ce8df82ece0fb718dff6f708fd7d7251efab142e857b6a30c (container=8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98, name=bridge, type=bridge)

2019-03-06T22:04:15.730415517+01:00 volume mount e060d957c24b8690cf2fa49934d06c361190fed8d2a495a38dd896e6b83d5fb8 (container=8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98, destination=/var/lib/rancher, driver=local, propagation=, read/write=true)

2019-03-06T22:04:15.730482959+01:00 volume mount a0934fe71a154a4ed955a9bda0fbc0045218034517b7214dfcc058e074480c5c (container=8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98, destination=/var/log/auditlog, driver=local, propagation=, read/write=true)

2019-03-06T22:04:16.267125226+01:00 container start 8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98 (image=rancher/rancher:latest, name=admiring_chaum, org.label-schema.build-date=2019-03-06T18:22:27Z, org.label-schema.schema-version=1.0, org.label-schema.vcs-ref=6472ba0c03ff7a222f5891ce5272e2e4261d8f58, org.label-schema.vcs-url=https://github.com/rancher/rancher.git)

rancher version v2.1.7

2019-03-06T22:04:16.705434718+01:00 container die 8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98 (exitCode=0, image=rancher/rancher:latest, name=admiring_chaum, org.label-schema.build-date=2019-03-06T18:22:27Z, org.label-schema.schema-version=1.0, org.label-schema.vcs-ref=6472ba0c03ff7a222f5891ce5272e2e4261d8f58, org.label-schema.vcs-url=https://github.com/rancher/rancher.git)

2019-03-06T22:04:16.808166391+01:00 network disconnect 80a31acde66e6d0ce8df82ece0fb718dff6f708fd7d7251efab142e857b6a30c (container=8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98, name=bridge, type=bridge)

2019-03-06T22:04:16.817567469+01:00 volume unmount e060d957c24b8690cf2fa49934d06c361190fed8d2a495a38dd896e6b83d5fb8 (container=8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98, driver=local)

2019-03-06T22:04:16.817624109+01:00 volume unmount a0934fe71a154a4ed955a9bda0fbc0045218034517b7214dfcc058e074480c5c (container=8a2e6d83c324d5c81919756b1e64bf5874e8923bb575acc0216f2d46fedd8c98, driver=local)

#6

I’m having the same problem. I have tried creating the “/opt/rancher” directory first, turning off SELinux, and changing the directory to 777. It made no difference, it still just goes into a restart loop.

Running without the volume works fine.


#7

The command is as it is shown in the docs, the -v is a docker run parameter, not a Rancher parameter.

docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  rancher/rancher:latest

#8

Thanks, that was my problem. I was just appending the -v parameter to the end.