简单记录下我在开发过程中,如何快速构建调试环境
RedisService
1 2 3 4
| docker run --restart=always -d -ti --name redisService \ -v /home/core/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf \ -v /home/core/redis/data:/data -p 16379:6379 redis \ redis-server /usr/local/etc/redis/redis.conf
|
1
| docker exec -it redisService redis-cli --raw -a redis
|
MysqlService
1 2 3 4
| docker run --restart=always -it --name mysqlService \ -v /home/core/mysql/data/:/var/lib/mysql \ -v /home/core/mysql/conf.d:/etc/mysql/conf.d \ -p 13306:3306 -e MYSQL\_ROOT\_PASSWORD=12345 -d mysql
|
MongoService
1 2 3
| docker run -ti --restart=always --name mongoService \ -v /home/core/mongo/data:/data/db -p 27017:27017 \ -d mongo --auth
|
1 2 3
| docker exec -it mongoService mongo admin; db.createUser({user:'admin',pwd:'admin',roles:[{role:'root',db:'admin'}]}); db.auth('admin','admin');
|
- 创建collection dmz_inward下的普通用户
1 2
| use dmz_inward; db.createUser({user:'dmz',pwd:'dmz',roles: [{role:'readWrite',db:'dmz_inward'}]});
|
NginxService
1 2 3 4
| docker run -it --restart=always --name nginxService -p 80:80 \ -v /home/core/yourResources: /usr/share/nginx/html:ro \ -v /logs:/var/log/nginx \ -v /home/core/conf/nginx/nginx.conf:ro -d nginx
|
RabbitmqService
1
| docker pull rabbitmq:3-management
|
1 2 3 4 5 6
| docker run --restart=always --name rabbitmqService \ --hostname fRabbit \ -p 5672:5672 -p 15672:15672 \ -v /home/core/rabbitmq/data:/var/lib/rabbitmq/mnesia/rabbit@fRabbit \ -v /home/core/rabbitmq/conf/rabbitmq.config:/etc/rabbitmq/rabbitmq.config:ro \ -d rabbitmq:3-management
|
1 2 3 4 5 6 7 8 9
| [ { rabbit, [ { loopback_users, [ ] }, { tcp_listeners, [ 5672 ] }, { default_user, <<"dmz">> }, #用户名 { default_pass, <<"dmz">> }, #密码 { ssl_listeners, [ ] }, { hipe_compile, false } ] },{rabbitmq_management, [{listener, [{port, 15672}]}]} ]
|
Portainer
漂亮的docker容器管理界面
1
| docker pull portainer/portainer`
|
1 2
| docker run -d --restart=always --name=portainer \ -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
|
Kafka
Kafka
参考
Docker Hub
It’s not like he’s dead or anything. He’s just… different. - Christopher Johnson
District 9