Difference between revisions of "Docker-compose up"

From wikieduonline
Jump to navigation Jump to search
 
(7 intermediate revisions by 4 users not shown)
Line 13: Line 13:
 
* <code>[[docker-compose -f]] NAME_OF_YOUR_FILE up</code>
 
* <code>[[docker-compose -f]] NAME_OF_YOUR_FILE up</code>
 
<ref>https://docs.docker.com/compose/reference/up/</ref> Builds, (re)creates, starts, and attaches to containers for a service.
 
<ref>https://docs.docker.com/compose/reference/up/</ref> Builds, (re)creates, starts, and attaches to containers for a service.
 
+
* <code>[[docker-compose up --force-recreate]]</code>
 
+
* <code>[[docker-compose up —-no-start]]</code>
  
  
Line 69: Line 69:
 
  "[[/etc/prometheus/prometheus.yml]]": mount /host_mnt/Users/user/prometheus.yml:/etc/prometheus/prometheus.yml (via  
 
  "[[/etc/prometheus/prometheus.yml]]": mount /host_mnt/Users/user/prometheus.yml:/etc/prometheus/prometheus.yml (via  
 
  [[/proc/self/]]fd/14), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the [[expected type]]
 
  [[/proc/self/]]fd/14), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the [[expected type]]
 +
 +
[[docker-compose up (Erigon)]]
  
 
== Related commands ==
 
== Related commands ==
 
* {{Docker-compose operations}}
 
* {{Docker-compose operations}}
* <code>[[docker-compose logs]]</code>
+
* <code>[[docker-compose logs]], [[docker-compose logs -f]]</code>
 
* <code>[[docker-compose pull]]</code>
 
* <code>[[docker-compose pull]]</code>
 
* [[Docker-compose.yml examples]]
 
* [[Docker-compose.yml examples]]
 
* <code>[[docker-compose down]] && [[docker-compose build]] --pull && [[docker-compose up]] -d</code>
 
* <code>[[docker-compose down]] && [[docker-compose build]] --pull && [[docker-compose up]] -d</code>
 
* <code>[[docker image ls]]</code>
 
* <code>[[docker image ls]]</code>
 +
* <code>[[--no-deps]]</code>
 +
* [[Docker volumes]]
  
 
== See also ==
 
== See also ==

Latest revision as of 06:42, 15 March 2023

docker-compose builds, (re)creates, starts, and attaches to containers for a service.

Examples[edit]

-d daemon

[1] Builds, (re)creates, starts, and attaches to containers for a service.


https://docs.docker.com/compose/reference/up/ If there are existing containers for a service, and the service’s configuration or image was changed after the container’s creation, docker-compose up picks up the changes by stopping and recreating the containers (preserving mounted volumes). To prevent Compose from picking up changes, use the --no-recreate flag.

docker-compose up, and docker-compose start will now start containers in parallel where possible.


  • docker-compose up
  • docker-compose up SERVICE_NAME
docker-compose up -d
Recreating SERVICE_NAME... done
  • Build containers but do not start them:
docker-compose up --no-start
  • Upgrade a container:
docker-compose pull && docker-compose up -d


docker-compose up -d SERVICE_NAME
Creating volume "VOLUME_NAME" with default driver
Creating SERVICE_NAME ... done
  • Using specific docker compose file:
docker-compose -f NAME_OF_YOUR_FILE up

Examples with errors[edit]

docker-compose up
ERROR: The Compose file is invalid because:
Service SERVICE_NAME has neither an image nor a build context specified. At least one must be provided.
docker-compose up
ERROR: yaml.parser.ParserError: while parsing a block mapping
 in "./docker-compose.yml", line 1, column 1
expected <block end>, but found '<block mapping start>'
 in "./docker-compose.yml", line 3, column 2
docker-compose up
ERROR: build path /srv/mattermost/db either does not exist, is not accessible, or is not a valid URL.
Solution: git clone https://github.com/mattermost/mattermost-docker.git
docker-compose up
ERROR:
        Can't find a suitable configuration file in this directory or any parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml, compose.yml, compose.yaml
docker-compose up
.../...
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start 
container process: error during container init: error mounting "/host_mnt/Users/user/prometheus.yml" to rootfs at 
"/etc/prometheus/prometheus.yml": mount /host_mnt/Users/user/prometheus.yml:/etc/prometheus/prometheus.yml (via 
/proc/self/fd/14), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
docker-compose up (Erigon)

Related commands[edit]

See also[edit]

  • https://docs.docker.com/compose/reference/up/
  • Advertising: