# \[Solved\] Move rancher-server to another host

**URL:** <https://forums.suse.com/t/solved-move-rancher-server-to-another-host/8406>\
**Category:** Rancher 1.x\
**Created:** [January 29, 2018, 2:44pm UTC](https://forums.suse.com/t/solved-move-rancher-server-to-another-host/8406 "2018-01-29T14:44:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre\_Pottie](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/pierre_pottie/32/3283_2.png) [@Pierre\_Pottie](https://forums.suse.com/u/Pierre_Pottie)\
**Post date:** [January 29, 2018, 2:44pm UTC](https://forums.suse.com/t/solved-move-rancher-server-to-another-host/8406/1 "2018-01-29T14:44:55Z")

</div>

Since few weeks , i try to move my rancher UI - Single Container (non-HA) (1.16.10) to an other host.  
all methods i can try failed :

- copy database , the container on new host close with no error …
- copy /var/lib/mysql on new host and mount at volume : container start and shutdown with no error … just exit 0
- try with external database : cant connect to external database  
"Cannot create JDBC driver of class ‘’ for connect URL ‘null’"  
after start manually mysql service and load dump , i restart the containter and my result is :

`[..] org.mariadb.jdbc.internal.util.dao.QueryException: Table 'region' already exists[..]`  
why? it’s must be like a just a reboot on the same version of rancher …

really need an export/import environment functionality…

---

<div class="post-metadata">

**Author:** ![Pierre\_Pottie](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/pierre_pottie/32/3283_2.png) [@Pierre\_Pottie](https://forums.suse.com/u/Pierre_Pottie)\
**Post date:** [January 30, 2018, 3:03pm UTC](https://forums.suse.com/t/solved-move-rancher-server-to-another-host/8406/2 "2018-01-30T15:03:00Z")

</div>

Move server to another host with SSL Letsencrypt

The initial case use the rancher / server docker image containing its own database service.

Extraction or loading issues dropped the entire service and prevented full loading of the extracted data file from the source server.

Solution found:

On source server, you have to copy make a copy of the rqd mysql bdd directory

on the source host

```auto
   $ docker cp <container-name-rancher-server>:/var/lib/mysql ./
   $ tar czvf mysql.tgz mysql

```

To perform on the target host

```auto
$ scp rancher @ <host_source>: ~ / rancher-server / mysql.tgz ./
$ tar xzvf mysql.tgz
$ chmod 102:105 -R mysql

```

use a docker-compose.yml like :

```auto
version: "3"
services:
        nginx-proxy:
            image: jwilder/nginx-proxy:latest
            ports:
               - "80:80"
               - "443:443"
            volumes:
               - '/home/rancher/nginx-proxy/ssl:/etc/nginx/certs:ro'
               - '/etc/nginx/vhost.d'
               - '/usr/share/nginx/html'
               - '/var/run/docker.sock:/tmp/docker.sock:ro'
        letsencrypt-nginx-proxy-companion:
            image: ppottie/letsencrypt-npc:latest # specific image for certif generation (like letsencrypt-nginx-proxy-companion but on old version)
            volumes:
               - '/home/rancher/nginx-proxy/ssl:/etc/nginx/certs:rw'
               - '/var/run/docker.sock:/var/run/docker.sock:ro'
               - '/etc/nginx/vhost.d'
               - '/usr/share/nginx/html'
        rancher-server:
            image: rancher/server:latest
            volumes:
                    - "/home/rancher/rancher-server/mysql:/var/lib/mysql"
            environment:
               VIRTUAL_PORT: 8080
               VIRTUAL_HOST: <URL_HOST>
               LETSENCRYPT_HOST: <URL_HOST>
               LETSENCRYPT_EMAIL: <EMAIL>

```

---

<div class="post-metadata">

**Author:** ![superseb](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/superseb/32/2424_2.png) [@superseb](https://forums.suse.com/u/superseb)\
**Post date:** [January 30, 2018, 4:41pm UTC](https://forums.suse.com/t/solved-move-rancher-server-to-another-host/8406/3 "2018-01-30T16:41:35Z")

</div>

In case someone finds this, I also wrote a gist on this process before: [https://gist.github.com/superseb/f610bad1608d6ae5398e5dfc8d735cc7](https://gist.github.com/superseb/f610bad1608d6ae5398e5dfc8d735cc7)
