Can't connect Rancher to DB

Hi,

I’m trying to connect Rancher to a database but the command(s) in the installation docs don’t seem to be working for me. I’m probably missing something simple but it’s driving me insane. When I run the command below (with the actual values):

sudo docker run -d --restart=always -p 8080:8080
-e CATTLE_DB_CATTLE_MYSQL_HOST=
-e CATTLE_DB_CATTLE_MYSQL_PORT=
-e CATTLE_DB_CATTLE_MYSQL_NAME=
-e CATTLE_DB_CATTLE_USERNAME=
-e CATTLE_DB_CATTLE_PASSWORD=
rancher/server

I get:

docker: Error: image library/ not found.

So it seems to think the -e CATTLE_DB_CATTLE_MYSQL_HOST is actually a image

If I put rancher/server before the environment variables, such as:

sudo docker run -d --restart=always -p 8080:8080 rancher/server
-e CATTLE_DB_CATTLE_MYSQL_HOST=
-e CATTLE_DB_CATTLE_MYSQL_PORT=
-e CATTLE_DB_CATTLE_MYSQL_NAME=
-e CATTLE_DB_CATTLE_USERNAME=
-e CATTLE_DB_CATTLE_PASSWORD=

It pulls the Rancher image but I get:

7f2e22e8f75a2c03584c0e367383f2180c7864c3f31daa66b68700b8b774c14d
docker: Error response from daemon: Container command ‘-e’ not found or does not exist…

Can’t figure out which environment variable is the problem. I’ve tried it on different versions of Linux with the same results. At the moment, I am on Ubuntu 16.04 LTS on Google Cloud.

Probably a Rookie mistake with Docker.

Thanks

rancher/server definitely needs to go last, anything after the image is an option being passed as the command to the container. I’m guessing there’s probably special chars or something in your username or password that means they need to be quoted… Can you post something more like the actual command you’re running (e.g. replace all the letters with a, numbers with 1 or something like that so we can see what you’re running without you telling us your password).