How to configure Docker Compose with equivalent to -d option (detach)

Asked

Viewed 195 times

1

The following command runs a container with mysql in the background.

docker run -d -p 3306:3306 -e MYSQL_RANDOM_ROOT_PASSWORD=yes --name mysqldb mysql

The equivalent with the docker-compose.yml would be:

version: '2'

services:
  mysqldb:
    image: mysql
    ports:
      - 3306:3306
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: yes

But when I spin using docker-compose up the process stays in the foreground. How do I add the equivalent of the detach option (-d) of docker container run?

1 answer

2

  • But there is no way to indicate this in Docker-Compose.yml, it is not?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.