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 docker-compose.yml
would be:
version: '2'
services:
mysqldb:
image: mysql
ports:
- 3306:3306
environment:
MYSQL_RANDOM_ROOT_PASSWORD: yes
But when I run 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
?