Not the answer you need?
Register and ask your own question!

Running server with docker custom volumes

rpedrerorpedrero ContributorCurrent User Role Novice
I'm trying this:

docker create
-v /data/prometheus/data:/opt/prometheus/data
-v /data/consul-data:/opt/consul-data
-v /data/mysql:/var/lib/mysql
-v /data/grafana:/var/lib/grafana
--name pmm-data percona/pmm-server /bin/true


docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server


But with this config, the server doesn't start.

Can anyone help me?

Comments

  • rpedrerorpedrero Contributor Current User Role Novice
    Hi!

    I'm new at here, and this is my first post.

    I'm trying to run the docker image with custome volumes, because I want to save all data in /data.

    At here, my try.

    docker create \
    -v /data/prometheus/data:/opt/prometheus/data \
    -v /data/consul-data:/opt/consul-data \
    -v /data/mysql:/var/lib/mysql \
    -v /data/grafana:/var/lib/grafana \
    --name pmm-data \
    percona/pmm-server /bin/true


    docker run -d \
    -p 80:80 \
    --volumes-from pmm-data \
    --name pmm-server \
    --restart always \
    percona/pmm-server


    Also, I tried to run this as docker-composer.yml (my first preference)

    services:
    percona:
    image: percona/pmm-server
    restart: always
    ports:
    - 80:80
    volumes:
    - /data/prometheus/data:/opt/prometheus/data
    - /data/consul-data:/opt/consul-data
    - /data/mysql:/var/lib/mysql
    - /data/grafana:/var/lib/grafana


    This is I can see at /data,

    [email protected]:/data# ls -la *
    consul-data:
    total 8
    drwxr-xr-x 2 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..

    grafana:
    total 12
    drwxr-xr-x 3 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..
    -rw-r--r-- 1 root root 0 May 29 23:04 grafana.db
    drwxr-xr-x 3 root root 4096 May 29 23:26 plugins

    mysql:
    total 8
    drwxr-xr-x 2 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..

    prometheus:
    total 12
    drwxr-xr-x 3 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..
    drwxr-xr-x 2 root root 4096 May 29 23:04 data

    Volumes seems work correctly.

    But the server doesn't work, I have this:

    502 Bad Gateway
    nginx



    docker logs is showing this all time:


    2019-05-29 23:27:03,457 INFO exited: createdb (exit status 1; not expected)
    2019-05-29 23:27:04,458 INFO success: createdb3 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-29 23:27:04,461 INFO spawned: 'createdb' with pid 8093
    2019-05-29 23:27:04,937 INFO spawned: 'grafana' with pid 8096
    2019-05-29 23:27:04,976 INFO exited: grafana (exit status 1; not expected)
    2019-05-29 23:27:05,978 INFO success: createdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-29 23:27:06,004 INFO exited: dashboard-upgrade (exit status 1; not expected)
    2019-05-29 23:27:06,147 INFO spawned: 'dashboard-upgrade' with pid 8106
    2019-05-29 23:27:06,149 INFO success: dashboard-upgrade entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
    2019-05-29 23:27:06,152 INFO exited: qan-api (exit status 1; not expected)
    2019-05-29 23:27:06,346 INFO spawned: 'qan-api' with pid 8114
    2019-05-29 23:27:07,149 INFO exited: createdb2 (exit status 1; not expected)
    2019-05-29 23:27:08,151 INFO success: qan-api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-29 23:27:08,153 INFO spawned: 'createdb2' with pid 8118
    2019-05-29 23:27:08,468 INFO exited: createdb3 (exit status 1; not expected)
    2019-05-29 23:27:09,470 INFO success: createdb2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-29 23:27:09,472 INFO spawned: 'createdb3' with pid 8123



    Can anyone help me to mount the volumes and run the PMM?

    Many thanks

    Regars!
  • rpedrerorpedrero Contributor Current User Role Novice
    I do a dummy container with the mapped volumes to the /data

    docker create
    -v /data/prometheus/data:/opt/prometheus/data
    -v /data/consul-data:/opt/consul-data
    -v /data/mysql:/var/lib/mysql
    -v /data/grafana:/var/lib/grafana
    --name pmm-data percona/pmm-server /bin/true

    And then execute:

    docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server


    Also I tried as docker-compose.yml with the next configuration:


    services:
    percona:
    image: percona/pmm-server
    restart: always
    ports:
    - 80:80
    volumes:
    - /data/prometheus/data:/opt/prometheus/data
    - /data/consul-data:/opt/consul-data
    - /data/mysql:/var/lib/mysql
    - /data/grafana:/var/lib/grafana


    But both configs doesn't work.

    The logs shows:

    2019-05-30 07:33:07,541 INFO spawned: 'dashboard-upgrade' with pid 12318
    2019-05-30 07:33:07,543 INFO success: dashboard-upgrade entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
    2019-05-30 07:33:07,544 INFO exited: grafana (exit status 1; not expected)
    2019-05-30 07:33:08,012 INFO exited: createdb (exit status 1; not expected)
    2019-05-30 07:33:09,016 INFO spawned: 'createdb' with pid 12326
    2019-05-30 07:33:09,223 INFO exited: qan-api (exit status 1; not expected)
    2019-05-30 07:33:10,227 INFO spawned: 'qan-api' with pid 12335
    2019-05-30 07:33:10,228 INFO success: createdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:10,334 INFO exited: createdb2 (exit status 1; not expected)
    2019-05-30 07:33:11,336 INFO success: qan-api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:11,339 INFO spawned: 'createdb2' with pid 12339
    2019-05-30 07:33:11,342 INFO spawned: 'pmm-managed' with pid 12340
    2019-05-30 07:33:11,373 INFO exited: pmm-managed (exit status 2; not expected)
    2019-05-30 07:33:11,430 INFO exited: createdb3 (exit status 1; not expected)
    2019-05-30 07:33:12,432 INFO success: createdb2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:12,434 INFO spawned: 'createdb3' with pid 12351
    2019-05-30 07:33:12,869 INFO spawned: 'grafana' with pid 12354
    2019-05-30 07:33:12,912 INFO exited: grafana (exit status 1; not expected)
    2019-05-30 07:33:13,914 INFO success: createdb3 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:13,944 INFO exited: dashboard-upgrade (exit status 1; not expected)
    2019-05-30 07:33:14,108 INFO spawned: 'dashboard-upgrade' with pid 12361
    2019-05-30 07:33:14,110 INFO success: dashboard-upgrade entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
    2019-05-30 07:33:14,111 INFO exited: createdb (exit status 1; not expected)
    2019-05-30 07:33:14,315 INFO spawned: 'createdb' with pid 12367
    2019-05-30 07:33:15,244 INFO exited: qan-api (exit status 1; not expected)
    2019-05-30 07:33:16,248 INFO spawned: 'qan-api' with pid 12376
    2019-05-30 07:33:16,249 INFO success: createdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:16,361 INFO exited: createdb2 (exit status 1; not expected)
    2019-05-30 07:33:17,363 INFO success: qan-api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:17,365 INFO spawned: 'createdb2' with pid 12380
    2019-05-30 07:33:17,447 INFO exited: createdb3 (exit status 1; not expected)
    2019-05-30 07:33:18,449 INFO success: createdb2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
    2019-05-30 07:33:18,450 INFO spawned: 'createdb3' with pid 12384
    2019-05-30 07:33:19,342 INFO exited: createdb (exit status 1; not expected)
    2019-05-30 07:33:19,441 INFO spawned: 'createdb' with pid 12389
    2019-05-30 07:33:19,453 INFO spawned: 'grafana' with pid 12390




    And the /data files:

    [email protected]:/data# ls -la *
    consul-data:
    total 8
    drwxr-xr-x 2 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..

    grafana:
    total 12
    drwxr-xr-x 3 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..
    -rw-r--r-- 1 root root 0 May 29 23:04 grafana.db
    drwxr-xr-x 3 root root 4096 May 30 07:31 plugins

    mysql:
    total 8
    drwxr-xr-x 2 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..

    prometheus:
    total 12
    drwxr-xr-x 3 root root 4096 May 29 23:04 .
    drwxrwxrwx 6 root root 4096 May 29 23:04 ..
    drwxr-xr-x 2 root root 4096 May 29 23:04 data
    [email protected]:/data#


    If I run the container without volumes, work correctly.


    Can anyone help me?

    Many thanks
  • rpedrerorpedrero Contributor Current User Role Novice
    Sorry for the duplicated messages, when I post, i didn't she the post and I thing something was wrong.
  • lduriezlduriez Entrant Current User Role Contributor
    Hello,

    I managed to do what you want, doing it this way :

    mkdir -p /usr/local/pmm/opt/prometheus/data
    mkdir -p /usr/local/pmm/opt/consul-data
    mkdir -p /usr/local/pmm/var/lib/mysql
    mkdir -p /usr/local/pmm/var/lib/grafana
    docker run -d -p 8080:443 -v /opt/prometheus/data -v /opt/consul-data -v /var/lib/mysql -v /var/lib/grafana -e ORCHESTRATOR_ENABLED=true -e ORCHESTRATOR_USER=*** -e ORCHESTRATOR_PASSWORD=*** --name pmm-server --restart always percona/pmm-server
    docker cp pmm-server:/opt/prometheus/data /usr/local/pmm/opt/prometheus/
    docker cp pmm-server:/opt/consul-data /usr/local/pmm/opt/
    docker cp pmm-server:/var/lib/mysql /usr/local/pmm/var/lib/
    docker cp pmm-server:/var/lib/grafana /usr/local/pmm/var/lib/
    docker stop
    docker rm pmm-server
    docker run -d -p 8080:443 -v /usr/local/pmm/opt/prometheus/data:/opt/prometheus/data -v /usr/local/pmm/opt/consul-data:/opt/consul-data -v /usr/local/pmm/var/lib/mysql:/var/lib/mysql -v /usr/local/pmm/var/lib/grafana:/var/lib/grafana -e ORCHESTRATOR_ENABLED=true -e ORCHESTRATOR_USER=*** -e ORCHESTRATOR_PASSWORD=*** --name pmm-server --restart always percona/pmm-server

    I think to docker need to initialize some files first and that's why we can't expose the volumes for the first run.
  • rpedrerorpedrero Contributor Current User Role Novice
    lduriez wrote: »
    Hello,

    I managed to do what you want, doing it this way :

    mkdir -p /usr/local/pmm/opt/prometheus/data
    mkdir -p /usr/local/pmm/opt/consul-data
    mkdir -p /usr/local/pmm/var/lib/mysql
    mkdir -p /usr/local/pmm/var/lib/grafana
    docker run -d -p 8080:443 -v /opt/prometheus/data -v /opt/consul-data -v /var/lib/mysql -v /var/lib/grafana -e ORCHESTRATOR_ENABLED=true -e ORCHESTRATOR_USER=*** -e ORCHESTRATOR_PASSWORD=*** --name pmm-server --restart always percona/pmm-server
    docker cp pmm-server:/opt/prometheus/data /usr/local/pmm/opt/prometheus/
    docker cp pmm-server:/opt/consul-data /usr/local/pmm/opt/
    docker cp pmm-server:/var/lib/mysql /usr/local/pmm/var/lib/
    docker cp pmm-server:/var/lib/grafana /usr/local/pmm/var/lib/
    docker stop
    docker rm pmm-server
    docker run -d -p 8080:443 -v /usr/local/pmm/opt/prometheus/data:/opt/prometheus/data -v /usr/local/pmm/opt/consul-data:/opt/consul-data -v /usr/local/pmm/var/lib/mysql:/var/lib/mysql -v /usr/local/pmm/var/lib/grafana:/var/lib/grafana -e ORCHESTRATOR_ENABLED=true -e ORCHESTRATOR_USER=*** -e ORCHESTRATOR_PASSWORD=*** --name pmm-server --restart always percona/pmm-server

    I think to docker need to initialize some files first and that's why we can't expose the volumes for the first run.


    Many thanks!
    That works for me :)
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.