工具类

Nexus

  1. mkdir /www/data/nexus-data && chown -R 200 /www/data/nexus-data
  2. docker run -d -p 8081:8081 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms2g -Xmx2g -XX:MaxDirectMemorySize=3g" -v /www/data/nexus-data:/nexus-data sonatype/nexus3

kibana

  1. docker run --name kibana -p 5601:5601 -e ELASTICSEARCH_URL=http://192.168.1.1:9200 -d kibana:6.4.3

elasticsearch-head

  1. # https://github.com/mobz/elasticsearch-head
  2. docker run -d -p 9100:9100 --name eshead mobz/elasticsearch-head:5

基础服务类

gitlab-ce

  1. docker pull gitlab/gitlab-ce:10.2.0-rc2.ce.0
  2. docker run --detach \
  3. --hostname 119.23.236.237 \
  4. --publish 5443:443 --publish 5008:80 --publish 3022:22 \
  5. --name gitlab \
  6. --restart always \
  7. --volume /www/dockers/gitlab_data/config:/etc/gitlab \
  8. --volume /www/dockers/gitlab_data/logs:/var/log/gitlab \
  9. --volume /www/dockers/gitlab_data/data:/var/opt/gitlab \
  10. gitlab/gitlab-ce:latest
  11. docker exec -it gitlab /bin/bash

percona-server:5.7

  1. chown 1001 /www/data/docker/mysql/data
  2. docker pull percona/percona-server:5.7
  3. docker run --name mysql -p 4306:3306 -v /www/data/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Hello2018 -d percona/percona-server:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
  4. # v5.7
  5. update user set authentication_string=password('Mydb2018') where user='zc';
  6. grant all privileges on *.* to 'qizai'@'%' identified by 'Mydb2018';
  7. flush privileges;
  8. ---
  9. # 通过创建docker文件目录进行挂载
  10. docker volume create data_mysql
  11. # 查看目录
  12. docker volume inspect data_mysql
  13. docker run --name mysql -p 4306:3306 -v -v /Users/docker/mysql-cnf/my.cnf:/etc/mysql/my.cnf -v data_mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dev#mysql -d percona/percona-server:5.7
  14. docker run --name mysql-3306 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=dev#mysql -d percona/percona-server:5.7

mariadb

https://hub.docker.com/_/mariadb/

  1. docker pull mariadb:10.3.14
  2. /my/custom/config-mysql.cnf
  3. docker run --name mariadb -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=MY.root -d mariadb:10.3.14
  4. docker run --name mariadb -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=MY.root -d mariadb:10.3.14
  5. docker run -it --rm mariadb mysql -hsome.mysql.host -usome-mysql-user -p

my.cnf

  1. [mysqld]
  2. character-set-server=utf8mb4
  3. server-id=115
  4. datadir=/var/lib/mysql
  5. socket=/var/lib/mysql/mysql.sock
  6. sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
  7. symbolic-links=0
  8. innodb_data_home_dir=/var/lib/mysql
  9. #innodb_data_file_path=ibdata1:2048M:autoextend
  10. innodb_file_per_table=1
  11. #innodb_file_format=barracuda
  12. #innodb_buffer_pool_size = 2G
  13. innodb_buffer_pool_instances=2
  14. innodb_purge_threads=1
  15. innodb_buffer_pool_dump_at_shutdown = 1
  16. innodb_buffer_pool_dump_now = 1
  17. innodb_buffer_pool_load_at_startup = 1
  18. innodb_buffer_pool_load_now = 1
  19. innodb_io_capacity=200
  20. innodb_read_io_threads=4
  21. innodb_write_io_threads=4
  22. innodb_change_buffering=all
  23. innodb_stats_on_metadata=off
  24. innodb_log_group_home_dir=/var/lib/mysql/innodb_log/
  25. innodb_log_buffer_size = 16M
  26. innodb_log_file_size = 256M
  27. innodb_log_files_in_group = 3
  28. innodb_flush_log_at_trx_commit=0
  29. innodb_autoinc_lock_mode=2
  30. innodb_print_all_deadlocks = 1
  31. innodb_thread_concurrency=8
  32. query_cache_size=128M
  33. log_slave_updates=ON
  34. slave_skip_errors=1062,1396
  35. sort_buffer_size=16M
  36. log-bin=/var/lib/mysql/log-bin.log
  37. relay_log=/var/lib/mysql/relay-bin.log
  38. binlog_cache_size = 1M
  39. binlog_format=MIXED
  40. max_binlog_size=256M
  41. max_binlog_cache_size=2048M
  42. max_tmp_tables=100
  43. max_prepared_stmt_count=1048576
  44. replicate-ignore-db=mysql,information_schema,sys,performance_schema
  45. expire_logs_days = 30
  46. sync_binlog=2
  47. wait_timeout=31536000
  48. interactive_timeout=31536000
  49. slow_query_log = 1
  50. long_query_time=1
  51. slow_query_log_file=/var/lib/mysql/slow-queries.log
  52. log-queries-not-using-indexes
  53. log-error=/var/lib/mysql/mysql.log
  54. [mysqld_safe]
  55. log-error=/var/lib/mysql/mysql.log
  56. #malloc-lib=/usr/lib64/libmagic.so.1
  57. pid-file=/var/lib/mysql/mysql.pid
  58. #[client]
  59. #socket=/var/lib/mysql/mysql.sock
  60. #[mysql]
  61. #socket=/var/lib/mysql/mysql.sock

percona-server-mongodb

  1. docker pull percona/percona-server-mongodb:3.4.9 #已于2020.1停止维护
  2. docker pull percona/percona-server-mongodb:4.2.8 #截止2020.7最新版本
  3. # 20190509
  4. docker run --name mongodb -p 27017:27017 -v /Users/qizai/www/docker/mongo/data:/data/db -v /Users/qizai/www/docker/mongo/mongod.conf:/etc/mongod.conf -d percona/percona-server-mongodb:3.4.9
  5. docker run --name mongodb -p 27017:27017 -v /Users/qizai/workspace/open_docker/mongodb/data:/data/db -d percona/percona-server-mongodb --storageEngine=RocksDB
  6. docker run --name percona-server-mongodb-v3.4.9 -p 27017:27017 -v /www/server/mongodb/data:/data/db -v /www/conf.d/mongo/mongo.cnf:/etc/mongo.cnf -d percona/percona-server-mongodb:3.4.9
  7. chmod -R go+w /www/data/docker_mongo/
  8. docker run --name mongodb -p 27017:27017 -v /www/data/docker_mongo:/data/db -v /www/data/config/mongodb.conf:/etc/mongo.cnf --security.authorization=enabled -d percona/percona-server-mongodb
  9. docker run -it --link mongo:link-mongo --rm mongo mongo --host mongo test
  10. docker run -d --name mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=mongopsw -d mongo

redis

  1. docker run -v /myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf
  2. docker run --name redis4 -p 6379:6379 -e ALLOW_EMPTY_PASSWORD=yes -v /Users/qizai/www/docker/redis-data:/bitnami/redis/data -v /Users/qizai/www/docker/redis-data/redis.conf:/opt/bitnami/redis/etc/redis.conf -d bitnami/redis:4.0

openrestory

  1. docker pull openresty/openresty:1.19.3.1-alpine #37Mb
  2. docker pull openresty/openresty:1.19.3.1-alpine-fat #116Mb
  3. docker run --name nginx -p 80:80 -v /Users/qizai/www/test/nginx/conf.d:/etc/nginx/conf.d -d openresty/openresty:alpine

elasticsearch

mkdir esdatadir
chmod g+rwx esdatadir
chgrp 1000 esdatadir

docker run --name elasticsearch6.4.3 -p 9200:9200 -p 9301:9300 -e "xpack.security.enabled=false" \
-v /Users/jnliok/www/docker/elasticsearch/config:/usr/share/elasticsearch/config \
-v /Users/jnliok/www/docker/elasticsearch/data:/usr/share/elasticsearch/data \
-v /Users/jnliok/www/docker/elasticsearch/logs:/usr/share/elasticsearch/logs \
-v /Users/jnliok/www/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
 -d elasticsearch:6.4.3