记录个人常用docker启动服务常用命令
redis
docker run --restart=always \
--log-opt max-size=100m \
--log-opt max-file=2 \
-p 6379:6379 --name myredis \
-v /home/docker/redis/redis.conf:/etc/redis/redis.conf \
-v /home/docker/redis/data:/data -d redis redis-server /etc/redis/redis.conf \
--appendonly yes --requirepass qwe123
mysql8
docker run --name mysql \
-v /home/docker/mysql80/log:/var/log/mysql \
-v /home/docker/mysql80/data:/var/lib/mysql \
-v /home/docker/mysql80/conf:/etc/mysql/conf.d \
-p 3307:3306 \
-e MYSQL_ROOT_PASSWORD=enterpassword \
-d mysql \
--init-connect="SET collation_connection=utf8mb4_0900_ai_ci" \
--init-connect="SET NAMES utf8mb4" \
--skip-character-set-client-handshake
中文portainer
docker run -d --restart=always --name="portainer" \
-p 9001:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
6053537/portainer-ce
nginx
docker run -p 9999:80 \
-v /home/docker/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /home/docker/nginx/logs:/var/log/nginx \
-v /home/docker/nginx/html:/usr/share/nginx/html \
-v /home/docker/nginx/conf:/etc/nginx/conf.d \
-v /etc/localtime:/etc/localtime \
--name nginx \
--restart=always \
-d nginx:1.22.0
Minio
docker run -d -p 9001:9000 --name minio \
-e "MINIO_ACCESS_KEY=minio" \
-e "MINIO_SECRET_KEY=qwe123" \
-v /home/docker/minio/data:/data \
-v /home/docker/minio/config:/root/.minio \
minio/minio server /data \
--console-address ":9000" --address ":9090"
Kinban
docker run -d \
--name=kibana \
--restart=always \
-p 5601:5601 \
-v /home/docker/kibana/config:/usr/share/kibana/config \
-v /home/docker/kibana/data:/usr/share/kibana/data \
kibana:7.17.6
es
docker run --name es --restart=always \
-p 9200:9200 -p 9300:9300 \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
-v /home/docker/es/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /home/docker/es/data:/usr/share/elasticsearch/data \
-v /home/docker/es/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.17.6
nacos
docker run -d --name nacos \
--ip 0.0.0.0 \
-p 8848:8848 \
-p 9848:9848 \
-p 9849:9849 \
--env MODE=standalone \
--env NACOS_AUTH_ENABLE=true \
-v /home/docker/nacos/conf:/home/nacos/conf \
-v /home/docker/nacos/logs:/home/nacos/logs \
-v /home/docker/nacos/data:/home/nacos/data \
nacos/nacos-server
gitlab
sudo docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
--shm-size 256m \
registry.gitlab.cn/omnibus/gitlab-jh:latest
mongodb
docker run -d \
--name mongodb \
-p 27017:27017 \
-v /home/docker/mongo/data:/data/db \
-v /home/docker/mongo/conf:/data/conf \
-v /home/docker/mongo/log:/data/log \
-e MONGO_INITDB_ROOT_USERNAME=admin \
-e MONGO_INITDB_ROOT_PASSWORD=123456 \
--privileged=true \
--restart always \
mongo:4.2