docker-compose.yml when you want to keep mysql running with docker

(1) Create docker-compose.yml

docker-compose.yml


version: "3.8"
services:
  db:
    image: mysql:5.7                   #Specify the version of mysql
    container_name: docker_mysql
    ports:
      - "3307:3306"                    #Specify the port to start DB
    environment:
      - MYSQL_USER=root
      - MYSQL_PASSWORD=
      - MYSQL_ROOT_PASSWORD=
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes #Allow no password
    volumes:
      - mysql-db-data:/var/lib/mysql   #Data persistence
    tty: true                          #Keep starting the container
volumes:
  mysql-db-data:
    driver: local

(2) Start mysql docker-compose up -d

(3) Connect to mysql mysql -u root -h 127.0.0.1 -P 3307

Recommended Posts

docker-compose.yml when you want to keep mysql running with docker
When you want to explicitly write OR or AND with ransack
When you want to change the MySQL password of docker-compose
lombok.config when you want to pass @Qualifier to @RequiredArgsConstructor with lombok
Update MySQL from 5.7 to 8.0 with Docker
Keep docker container running with no resident process running
When you want to bind InputStream in JDBI3
When you want to use the method outside
[Ruby] When you want to replace multiple characters
[Docker] Connection with MySQL
Until you try running Apache Kafka with docker image
Whether to enable SSL when using JDBC with MySQL.
If you want to use Mockito with Kotlin, use mockito-kotlin
When you want to dynamically replace Annotation in Java8
Command when you want to erase all Docker images and containers cleanly and start over
Code to use when you want to process Json with only standard library in Java
[Ruby + Rails] When you want to register in Mailchimp's mail list together with user registration
I tried to make an introduction to PHP + MySQL with Docker
What to do when you launch an application with rails
How to write in Model class when you want to save binary data in DB with PlayFramework
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Express ~
Delegate is convenient to use when you want to reuse parts
Things to keep in mind when using Sidekiq with Rails
Measures for permissions when building MySQL with Docker on WSL2
You are required to use winpty with docker exec [Windows]
How to write when you want to keep line breaks and output while avoiding XSS in Rails
[For super beginners] The minimum knowledge you want to keep in mind with hashes and symbols
When requested access to the resource is denied when pushing with Docker
ProxyFactory is convenient when you want to test AOP in Spring!
I want to INSERT Spring Local Time with MySQL Time (also milliseconds)
I want to avoid OutOfMemory when outputting large files with POI
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ MySQL edition ~
When you want to ZIP download the image data saved locally
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
Stupid mistake I made when running nginx server with Docker Compose
When you have introduced devise but want to add more columns
[Rails] I want to add data to Params when transitioning with link_to
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Sequelize ~
I want to notice that I forgot to specify arg when building Docker
Practice to use when you want to execute different processing groups serially
Rails + MySQL environment construction with Docker
Try running cloudera manager with docker
Read dump file with Docker MySQL
mysql2 fails to install with bundle install
[Environment construction with Docker] Rails 6 & MySQL 8
mysql doesn't start up with docker.
How to start Camunda with Docker
The first thing to do when you want to be happy with Heroku on GitHub with Eclipse in Java
When I tried to build an environment of PHP7.4 + Apache + MySQL with Docker, I got stuck [Windows & Mac]
A memo when you want to clear the time part of the calendar
When you want Rails to disable a session for a specific controller only
Problems I was addicted to when building the digdag environment with docker
Things to keep in mind when using Apache PDFBox® with AWS Lambda
If you want to make a zip file with Ruby, it's rubyzip.
After all I wanted to preview the contents of mysql with Docker ...
How to share files with Docker Toolbox
[Rails] How to use rails console with docker
Try running MySql and Blazor with docker-compose
I want to use DBViewer with Eclipse 2018-12! !!
Edit Mysql with commands in Docker environment
Try running Slack's (Classic) Bot with docker