docker安装Mysql5.7
docker run -itd --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
docker run -p 3306:3306 --name mysql -v /root/mysql/conf:/etc/mysql/conf.d -v /root/mysql/logs:/logs -v /root/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=1234567 -d mysql:5.7
docker-compose安装mysql:
- version : '3'
- services:
- mysql:
- container_name: mysql
- image: mysql:5.7
- build:
- context: ./mysql
- ports:
- - "3307:3306"
- volumes:
- - ./mysql/conf:/etc/mysql/conf.d
- - ./mysql/logs:/logs
- - ./mysql/data:/var/lib/mysql
- - ./mysql/init-sql/:/docker-entrypoint-initdb.d
- command: [
- 'mysqld',
- '--innodb-buffer-pool-size=80M',
- '--character-set-server=utf8mb4',
- '--collation-server=utf8mb4_unicode_ci',
- '--default-time-zone=+8:00',
- '--lower-case-table-names=1'
- ]
- environment:
- MYSQL_DATABASE: 'virbac'
- MYSQL_ROOT_PASSWORD: '123456'
- restart: always
- api:
- container_name: api
- image: virbac-api
- build:
- context: virbac-api
- dockerfile: Dockerfile
- ports:
- - "8000:8000"
- depends_on:
- - mysql
- links:
- - mysql:mysql
- restart: always
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · Amazon Linux 2023 安装Docker和Docker Compose
- · 修改Docker的默认网段
- · docker定时任务Mysql脚本
- · 解决Linux实例磁盘空间满问题
- · failed to fetch metadata: fork/exec /home/appuser/.docker/cli-plugins/docker-buildx: exec format error
- · Docker登录login报错Error saving credentials
- · docker安装mysql8注意事项
- · 黑群晖docker无法pull镜像,x509错误解决方法
- · k3s+kuboard快速搭建K8s生产环境集群
- · 解决es报错:blocked by: [FORBIDDEN/12/index read-only / allow delete (api) ]
- · filebeat按docker容器名创建不同的索引
- · traefik负载均衡/滚动升级