You will need to change directory before executing the commands below with:
cd dockerThis is only intended to be run in a development environment where ports 3306 / default for MySQL - 5432 / default for PostgreSQL and 4306 custom port - MariaDB are free and not used.
If they are already used make sure to change the ports like this
ports:
- '3307:3306' # only change the first numberDocker images can be overridden by creating a docker-compose.override.yml.
By default, Compose reads two files, a
docker-compose.ymland an optionaldocker-compose.override.ymlfile. By convention, thedocker-compose.ymlcontains your base configuration. The override file, as its name implies, can contain configuration overrides for existing services or entirely new services.(https://docs.docker.com/compose/extends/#understanding-multiple-compose-files)
In detached/background mode using -d (recommended)
docker compose up -d
# Or start only one service
docker compose up -d mysql
# To see logs
docker compose logs -f mysqlIn attached mode, the logs will be streamed in the terminal:
docker compose up
# Or start only one service
docker compose up mysqldocker compose downdocker compose down -v --rmi all --remove-orphans