title: Different result using docker-compose vs docker run
body: <p>I am setting up a generic common database that I can link to with other containers. I am encountering different results when using <code>docker-compose</code> and <code>docker run</code>.</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre class="lang-yaml prettyprint-override"><code>mysql:
      image: mariadb:10.1
      ports:
          - 3306:3306
      environment:
          MYSQL_ROOT_PASSWORD: root-secret
          MYSQL_USER: dbuser
          MYSQL_PASSWORD: my-secret
      volumes:
          - ./conf:/etc/mysql/conf.d
          - ./data:/var/lib/mysql
          - ./logs:/var/log/mysql
  pma:
      image: phpmyadmin/phpmyadmin
      links:
          - mysql:db
      ports:
          - 8088:80
      environment:
          MYSQL_ROOT_PASSWORD: root-secret
          MYSQL_USER: dbuser
          MYSQL_PASSWORD: my-secret
  </code></pre>
  
  <p>The docker commands that I am running are:</p>
  
  <pre class="lang-none prettyprint-override"><code>docker run -d -P --name mysql -v conf:/etc/mysql/conf.d -v data:/var/lib/mysql \
      -v logs:/var/log/mysql -e MYSQL_ROOT_PASSWORD=root-secret \
      -e MYSQL_USER=dbuser -e MYSQL_PASSWORD=my-secret -p 3306:3306 mariadb:10.1
  docker run -d --name pma --link mysql:db  -e MYSQL_ROOT_PASSWORD=root-secret \
      -e MYSQL_USER=dbuser -e MYSQL_PASSWORD=my-secret -p 8088:80 phpmyadmin/phpmyadmin
  </code></pre>
  
  <p>When using <code>docker-compose up -d</code>, everything works properly and my host's data directory is filled with the database files. In addition, phpmyadmin is able to connect to the database container without issue.</p>
  
  <p>When using the docker commands the host's data directory stays empty and the data is stored within the container. phpmyadmin gives me "access denied" when attempting to login as well.</p>
  
  <p>Can anyone tell me why the data volume mounts properly and phpmyadmin is able to comunicate when using docker-compose but not with docker?</p>