工具类
Nexus
mkdir /www/data/nexus-data && chown -R 200 /www/data/nexus-data
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
docker run --name kibana -p 5601:5601 -e ELASTICSEARCH_URL=http://192.168.1.1:9200 -d kibana:6.4.3
elasticsearch-head
# https://github.com/mobz/elasticsearch-head
docker run -d -p 9100:9100 --name eshead mobz/elasticsearch-head:5
基础服务类
gitlab-ce
docker pull gitlab/gitlab-ce:10.2.0-rc2.ce.0
docker run --detach \
--hostname 119.23.236.237 \
--publish 5443:443 --publish 5008:80 --publish 3022:22 \
--name gitlab \
--restart always \
--volume /www/dockers/gitlab_data/config:/etc/gitlab \
--volume /www/dockers/gitlab_data/logs:/var/log/gitlab \
--volume /www/dockers/gitlab_data/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
docker exec -it gitlab /bin/bash
percona-server:5.7
chown 1001 /www/data/docker/mysql/data
docker pull percona/percona-server:5.7
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
# v5.7
update user set authentication_string=password('Mydb2018') where user='zc';
grant all privileges on *.* to 'qizai'@'%' identified by 'Mydb2018';
flush privileges;
---
# 通过创建docker文件目录进行挂载
docker volume create data_mysql
# 查看目录
docker volume inspect data_mysql
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
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/
docker pull mariadb:10.3.14
/my/custom/config-mysql.cnf
docker run --name mariadb -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=MY.root -d mariadb:10.3.14
docker run --name mariadb -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=MY.root -d mariadb:10.3.14
docker run -it --rm mariadb mysql -hsome.mysql.host -usome-mysql-user -p
my.cnf
[mysqld]
character-set-server=utf8mb4
server-id=115
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
symbolic-links=0
innodb_data_home_dir=/var/lib/mysql
#innodb_data_file_path=ibdata1:2048M:autoextend
innodb_file_per_table=1
#innodb_file_format=barracuda
#innodb_buffer_pool_size = 2G
innodb_buffer_pool_instances=2
innodb_purge_threads=1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_dump_now = 1
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_load_now = 1
innodb_io_capacity=200
innodb_read_io_threads=4
innodb_write_io_threads=4
innodb_change_buffering=all
innodb_stats_on_metadata=off
innodb_log_group_home_dir=/var/lib/mysql/innodb_log/
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit=0
innodb_autoinc_lock_mode=2
innodb_print_all_deadlocks = 1
innodb_thread_concurrency=8
query_cache_size=128M
log_slave_updates=ON
slave_skip_errors=1062,1396
sort_buffer_size=16M
log-bin=/var/lib/mysql/log-bin.log
relay_log=/var/lib/mysql/relay-bin.log
binlog_cache_size = 1M
binlog_format=MIXED
max_binlog_size=256M
max_binlog_cache_size=2048M
max_tmp_tables=100
max_prepared_stmt_count=1048576
replicate-ignore-db=mysql,information_schema,sys,performance_schema
expire_logs_days = 30
sync_binlog=2
wait_timeout=31536000
interactive_timeout=31536000
slow_query_log = 1
long_query_time=1
slow_query_log_file=/var/lib/mysql/slow-queries.log
log-queries-not-using-indexes
log-error=/var/lib/mysql/mysql.log
[mysqld_safe]
log-error=/var/lib/mysql/mysql.log
#malloc-lib=/usr/lib64/libmagic.so.1
pid-file=/var/lib/mysql/mysql.pid
#[client]
#socket=/var/lib/mysql/mysql.sock
#[mysql]
#socket=/var/lib/mysql/mysql.sock
percona-server-mongodb
docker pull percona/percona-server-mongodb:3.4.9 #已于2020.1停止维护
docker pull percona/percona-server-mongodb:4.2.8 #截止2020.7最新版本
# 20190509
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
docker run --name mongodb -p 27017:27017 -v /Users/qizai/workspace/open_docker/mongodb/data:/data/db -d percona/percona-server-mongodb --storageEngine=RocksDB
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
chmod -R go+w /www/data/docker_mongo/
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
docker run -it --link mongo:link-mongo --rm mongo mongo --host mongo test
docker run -d --name mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=mongopsw -d mongo
redis
docker run -v /myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf
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
docker pull openresty/openresty:1.19.3.1-alpine #37Mb
docker pull openresty/openresty:1.19.3.1-alpine-fat #116Mb
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