title: How to move docker volume to disk location?
body: <p>I have a <a href="https://hub.docker.com/_/mysql" rel="nofollow noreferrer">MySQL docker image</a> running in a docker container on Ubuntu VPS. I bring up MySQL using the <code>docker-compose up -d</code> command via the following <code>docker-composer.yml</code> file</p>
  <pre><code>version: &quot;3&quot;
  services:
  
      mysql_server:
          image: mysql:8.0.21
          restart: always
          container_name: mysql_server
          environment:
              MYSQL_DATABASE: db_name
              MYSQL_USER: db_username
              MYSQL_PASSWORD: db_password
              MYSQL_ROOT_PASSWORD: root_password
          volumes:
              - mysql_server_data:/var/lib/mysql
              - /mysql/files/conf.d:/etc/mysql/conf.d
  </code></pre>
  <p>I am having some performance issues and would like to do the following in attempt to improve performance.</p>
  <ol>
  <li><p>I want the data in the <code>mysql_server_data</code> volume to be mounted on <code>/mysql/data</code> without losing any data as this instance in running in production.</p>
  </li>
  <li><p>I also want to mount the MySQL config file on <code>/mysql/files</code> so I can change the instance configuration to increase performance.</p>
  </li>
  </ol>
  <p><strong>Questions</strong></p>
  <p>How can change the data location of a the volume from <code>mysql_server_data</code> to <code>/mysql/data</code>?</p>
  <p>Also, how can I mount MySQL's config file on <code>/mysql/files/conf.d</code> to allow me to update the settings?</p>
  <p>I tried to mount config file like this</p>
  <pre><code>        volumes:
              - /mysql/files/conf.d:/etc/mysql/conf.d
  </code></pre>
  <p>But that created a directory <code>/mysql/files/conf.d</code> with no config file.</p>