title: Creating default user for influxdb 2.0 in docker-compose
body: <p>In previous versions of influxdb we could create an admin user by using the environment variables</p>
  <pre><code>influxdb:
      ...
      environment:
          INFLUXDB_HOSTNAME: &quot;${INFLUXDB_HOSTNAME}&quot;
          INFLUXDB_USERNAME: &quot;${INFLUXDB_USERNAME}&quot;
          INFLUXDB_PASSWORD: &quot;${INFLUXDB_PASSWORD}&quot;
      ...
  </code></pre>
  <p>But in version 2.0 these env. variables are removed</p>
  <p>What I want to achieve is, when I run the docker-compose up my_influx_db</p>
  <p>It should create a default admin user, if it doesn't exist</p>
  <p>What I tried so far is:</p>
  <pre><code>my_influx_db:
    image: quay.io/influxdb/influxdb:v2.0.3
    hostname: my_influx_db
    container_name: my_influx_db
    ports:
      - 8086:8086
    command: /bin/sh -c &quot;exec influxd &amp;&amp; sleep 10 &amp;&amp; influx setup -o test_org -b test_bucket -u user1 -p testpassword -f&quot;
  </code></pre>
  <p><code>docker-compose up my_influx_db</code> starts the influxdb, but doesn't run the setup script after 10 secs</p>
  <p>What is the right way to create default admin user?</p>
  <p>Edit:
  I managed to run it with the following configuration, but is it the right way to do it?</p>
  <pre><code>command: /bin/sh -c &quot;(sleep 10 &amp;&amp; echo setting up user &amp;&amp; influx setup -o test_org -b test-bucket -u influxdb -p influxdb -f) &amp; influxd&quot;
  </code></pre>