title: Undefined volume with Docker Compose
body: <p>I wanted to translate this docker CLI command (from <a href="https://hub.docker.com/r/smallstep/step-ca" rel="noreferrer">smallstep/step-ca</a>) into a docker-compose.yml file to run with <code>docker compose</code> (version 2):</p>
  <pre class="lang-sh prettyprint-override"><code>docker run -d -v step:/home/step \
      -p 9000:9000 \
      -e &quot;DOCKER_STEPCA_INIT_NAME=Smallstep&quot; \
      -e &quot;DOCKER_STEPCA_INIT_DNS_NAMES=localhost,$(hostname -f)&quot; \
      smallstep/step-ca
  </code></pre>
  <p>This command successfully starts the container.</p>
  <p>Here is the compose file I &quot;composed&quot;:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: &quot;3.9&quot;
  services:
    ca:
      image: smallstep/step-ca
      volumes:
        - &quot;step:/home/step&quot;
      environment:
        - DOCKER_STEPCA_INIT_NAME=Smallstep
        - DOCKER_STEPCA_INIT_DNS_NAMES=localhost,ubuntu
      ports:
        - &quot;9000:9000&quot;
  </code></pre>
  <p>When I run <code>docker compose up</code> (again, using v2 here), <strong>I get this error</strong>:</p>
  <blockquote>
  <p>service &quot;ca&quot; refers to undefined volume step: invalid compose project</p>
  </blockquote>
  <p>Is this the right way to go about this? I'm thinking I missed an extra step with volume creation in docker compose projects, but I am not sure what that would be, or if this is even a valid use case.</p>