title: docker compose yaml - command
body: <p>I want to run a creation of a new database using mysql</p>
  
  <p>this is the snippet I have in my <code>docker-compose.yml</code> file</p>
  
  <pre><code>mysql:
    image: mysql
    container_name: mysql-machine
    ports:
      - 3306:3306
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: true
      MYSQL_DATABASE: mxdb
      MYSQL_USER: mxdb
      MYSQL_PASSWORD: mxdb
    command: mysqladmin create testing_db
  </code></pre>
  
  <p>Now when i run <code>docker-compose up</code></p>
  
  <p>I watch the console, and it says </p>
  
  <pre><code>mysql_1    | mysqladmin: connect to server at 'localhost' failed
  mysql_1    | error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
  mysql_1    | Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
  </code></pre>
  
  <p>So how do I re-write the command piece, so i get the service working properly?</p>
  
  <p>I want to create more than one database. So manually using commands is the easiest way.</p>