Answers: <p>Why in your <code>docker-compose.yml</code> are you setting <code>entrypoint</code>, when your <code>docker run</code> command does not have a <code>--entrypoint</code> option?  You've also removed the <code>-d</code> option from the invocation, and you're passing the remaining options as individual arguments rather than the single string you're using in the <code>docker run</code> invocation.</p>
  <p>The equivalent to your <code>docker run</code> command line would be:</p>
  <pre><code>  postgres-2:
      image: livingdocs/postgres:14.4
      container_name: postgres-SLAVE
      ports:
        - &quot;5434:5432&quot;
      command:
        - standby
        - -d
        - &quot;host=host.docker.internal port=5433 user=postgres target_session_attrs=read-write&quot;
  
  </code></pre>
  <p>I've removed the <code>volumes</code> stanza, since you're not using any volumes on the <code>docker run</code> command line.</p>
  
  
Answers: CC BY-SA 4.0
Answers: 2022-06-28T13:31:53.253Z
Answers: 2022-06-28T13:31:53.253Z
Answers: larsks
Answers: <p>I got it working with:</p>
  <pre><code>  postgres-2:
      image: livingdocs/postgres:14.4
      container_name: postgres-SLAVE
      ports:
        - &quot;5434:5432&quot;
      volumes:
        - postgres2:/tmp/data
      entrypoint:
        - standby
      command: &quot;--host host.docker.internal --port 5433 --user postgres&quot;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2022-06-28T21:32:09.997Z
Answers: 2022-06-28T21:32:09.997Z
Answers: Ash
Body: <p>I am in some desperate help. I am atempting to translate this docker run command:</p>
  <pre><code>docker run -d -p 5434:5432 --name postgres-2 livingdocs/postgres:14.4 standby -d &quot;host=host.docker.internal port=5433 user=postgres target_session_attrs=read-write&quot;
  </code></pre>
  <p>which works flawlessly, but when I attempt to convert it to docker_compose.yml:</p>
  <pre><code>  postgres-2:
      image: livingdocs/postgres:14.4
      container_name: postgres-SLAVE
      ports:
        - &quot;5434:5432&quot;
      volumes:
        - postgres2:/tmp/data
      entrypoint: &quot;/scripts/entrypoint standby&quot;
      command:
        - host=host.docker.internal
        - port=5433
        - user=postgres
        - target_session_attrs=read-write&quot;
  </code></pre>
  <p>It throws:</p>
  <pre><code>pg_basebackup: error: too many command-line arguments (first is &quot;host=host.docker.internal&quot;)
  
  Try &quot;pg_basebackup --help&quot; for more information.
  </code></pre>
  <p>After I save the yml file and execute: <code>docker-compose up -d --remove-orphans</code></p>
  <p>I've tried the online conversion tools and about 300 variations, but I cannot get to function the same as docker run.</p>
  
Comments: CC BY-SA 4.0
Comments: 2022-06-28T08:58:44.187Z
Comments: I might be wrong, but it looks like in your original docker command the whole string is passed as a single argument.
Comments: tkausl
Tags: <docker><docker-compose>
Title: Arguments in docker_compose.yml throwing error, but not with docker run
UserDisplayName: Ash
ThreadText: # Arguments in docker_compose.yml throwing error, but not with docker run
  
  (Asked by: username_0 on 2022-06-28)
  
  I am in some desperate help. I am atempting to translate this docker run command:
  
  ```
  docker run -d -p 5434:5432 --name postgres-2 livingdocs/postgres:14.4 standby -d "host=host.docker.internal port=5433 user=postgres target_session_attrs=read-write"
  
  ```
  
  which works flawlessly, but when I attempt to convert it to docker\_compose.yml:
  
  ```
    postgres-2:
      image: livingdocs/postgres:14.4
      container_name: postgres-SLAVE
      ports:
        - "5434:5432"
      volumes:
        - postgres2:/tmp/data
      entrypoint: "/scripts/entrypoint standby"
      command:
        - host=host.docker.internal
        - port=5433
        - user=postgres
        - target_session_attrs=read-write"
  
  ```
  
  It throws:
  
  ```
  pg_basebackup: error: too many command-line arguments (first is "host=host.docker.internal")
  
  Try "pg_basebackup --help" for more information.
  
  ```
  
  After I save the yml file and execute: `docker-compose up -d --remove-orphans`
  
  I've tried the online conversion tools and about 300 variations, but I cannot get to function the same as docker run.
  
  **Tags:** docker, docker-compose
  
  > **Comments:**
  > **username_1**: I might be wrong, but it looks like in your original docker command the whole string is passed as a single argument.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2022-06-28. Score: 0
  
  Why in your `docker-compose.yml` are you setting `entrypoint`, when your `docker run` command does not have a `--entrypoint` option? You've also removed the `-d` option from the invocation, and you're passing the remaining options as individual arguments rather than the single string you're using in the `docker run` invocation.
  
  The equivalent to your `docker run` command line would be:
  
  ```
    postgres-2:
      image: livingdocs/postgres:14.4
      container_name: postgres-SLAVE
      ports:
        - "5434:5432"
      command:
        - standby
        - -d
        - "host=host.docker.internal port=5433 user=postgres target_session_attrs=read-write"
  
  ```
  
  I've removed the `volumes` stanza, since you're not using any volumes on the `docker run` command line.
  
  
  ---
  
  ### Answer by username_0 on 2022-06-28. Score: 0
  
  I got it working with:
  
  ```
    postgres-2:
      image: livingdocs/postgres:14.4
      container_name: postgres-SLAVE
      ports:
        - "5434:5432"
      volumes:
        - postgres2:/tmp/data
      entrypoint:
        - standby
      command: "--host host.docker.internal --port 5433 --user postgres"
  
  ```
  
  
  ---
  
  