docker ps找到对应的容器
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
35b528e77830 kibana:7.1.1 "/usr/local/bin/kiba…" 7 minutes ago Up 4 minutes 0.0.0.0:5601->5601/tcp kibana
8f346b1271eb mrvautin/adminmongo "docker-entrypoint.s…" 7 minutes ago Up 3 minutes 0.0.0.0:1234->1234/tcp adminmongo
d8af2a3e2344 dnmp_elasticsearch "/usr/local/bin/dock…" 7 minutes ago Restarting (1) 5 seconds ago elasticsearch
995adc6bed44 canal/canal-server:v1.1.3 "/alidata/bin/main.s…" 7 minutes ago Up 3 minutes 2222/tcp, 8000/tcp, 11112/tcp, 0.0.0.0:11111->11111/tcp canal-server
e489887a7cce mongo:4.1 "docker-entrypoint.s…" 7 minutes ago Up 3 minutes 0.0.0.0:27017->27017/tcp mongodb
f11ae0cf22b3 wurstmeister/zookeeper "/bin/sh -c '/usr/sb…" 4 months ago Up 4 minutes 22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp zookeeper
3c96e30bd939 wurstmeister/kafka "start-kafka.sh" 4 months ago Up 4 minutes 0.0.0.0:9092->9092/tcp kafka
134f7280d7f8 dnmp_php "docker-php-entrypoi…" 4 months ago Up 4 minutes 9000/tcp, 9501/tcp php
45dd9024157b dnmp_nginx "nginx -g 'daemon of…" 4 months ago Up 4 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nginx
01ef9bb81dc3 redis:5.0.3-alpine "redis-server /etc/r…" 7 months ago Up 4 minutes 0.0.0.0:6379->6379/tcp redis
14b347941abd mysql:8.0.13 "docker-entrypoint.s…" 7 months ago Up 4 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql
1cb8be9b7dd0 rabbitmq:management "docker-entrypoint.s…" 7 months ago Up 4 minutes 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbitmq
docker exec -it /bin/bash 进入容器内进行bash操作
docker exec -it 14b347941abd /bin/bash
root@14b347941abd:/# ls
bin boot dev docker-entrypoint-initdb.d entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
一般 mysql的部署文件位置为/etc/mysql/下
cd /etc/
root@14b347941abd:/etc# ls
X11 default gshadow- ld.so.cache mecabrc pam.d rc3.d selinux systemd
adduser.conf deluser.conf host.conf ld.so.conf mke2fs.conf passwd rc4.d shadow terminfo
alternatives dpkg hostname ld.so.conf.d motd passwd- rc5.d shadow- timezone
apt environment hosts ldap mtab perl rc6.d shells update-motd.d
bash.bashrc fstab init.d libaudit.conf mysql profile rcS.d skel
bindresvport.blacklist gai.conf inputrc localtime nsswitch.conf profile.d resolv.conf ssl
cron.daily group issue login.defs opt rc0.d rmt staff-group-for-usr-local
debconf.conf group- issue.net logrotate.d os-release rc1.d securetty subgid
debian_version gshadow kernel machine-id pam.conf rc2.d security subuid
root@14b347941abd:/etc# cd mysql/
root@14b347941abd:/etc/mysql# ls
conf.d my.cnf my.cnf.fallback
root@14b347941abd:/etc/mysql# vi my.cnf
修改my.conf
不存在vi
root@14b347941abd:/etc/mysql# apt-get install vim-gtk
Reading package lists... Done
Building dependency tree