自动重启

1
--restart=always

关闭 docker 的防火墙

1
DOCKER_OPTS="--iptables=false"

Elasticsearch

1
2
3
4
5
docker run --name=es \
  -v "/opt/docker/elasticsearch/config":/usr/share/elasticsearch/config \
  -v "/opt/docker/elasticsearch/data":/usr/share/elasticsearch/data \
  -p 9200:9200 -p 9300:9300 \
  -d elasticsearch -Des.node.name="FFGoNode"

Grafana

1
2
3
4
5
6
7
docker run \
  -d \
  -p 3000:3000 \
  --name=grafana \
  -e "GF_SECURITY_ADMIN_PASSWORD=123456" \
  -v /opt/docker/grafana:/var/lib/grafana \
  grafana/grafana

influxdb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
docker run --restart=always --name=influxdb \
  -p 8086:8086 -p 2003:2003 \
  -v /opt/docker/influxdb/:/var/lib/influxdb \
  -e INFLUXDB_GRAPHITE_ENABLED=true \
  -d influxdb

docker run --restart=always --name=kapacitor \
  -p 9092:9092 \
  -v /opt/docker/kapacitor/kapacitor.conf:/etc/kapacitor/kapacitor.conf:ro \
  -d kapacitor

nginx

1
2
3
4
5
6
7
docker run --restart=always --name=nginx \
-p 80:80 -p 443:443 \
-v /var/nginx/:/var/nginx/:ro \
-v /opt/docker/nginx/conf/conf.d/:/etc/nginx/conf.d/ \
-v /opt/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/docker/nginx/log:/var/log/nginx \
-d nginx:1.10

postgresql

1
docker run --name postgres --restart=always -p 5432:5432 -v /opt/docker/postgres/data:/var/lib/postgresql/data -e PGDATA=/var/lib/postgresql/data -e POSTGRES_PASSWORD=123456 -d postgres

mongo

1
2
3
4
docker run --name mongo -p 27017:27017 -v /opt/docker/mongo/db:/data/db -d mongo --auth
docker exec -it mongo mongo admin

db.createUser({ user: 'user1', pwd: '123456', roles: ["readWriteAnyDatabase","dbAdminAnyDatabase","clusterAdmin"] });

rabbitmq

1
docker run --hostname rabbit --name rabbit --restart=always -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=user1 -e RABBITMQ_DEFAULT_PASS=123456 -d rabbitmq:3-management

ghost(blog 中文)

1
docker run --restart=always --name ghost -v /opt/ghost/blog:/var/lib/ghost -p 8080:2368 -d luck9star/ghost-zh

pgadmin

1
docker run -d -p 5050:5050 -v /home/user/data:/data chorss/docker-pgadmin4

tensorflow

1
docker run --name tf -dit -v /opt/docker/tf/data:/notebooks/ -p 8888:8888 -p 6006:6006 tensorflow/tensorflow

mysql

1
2
3
4
5
docker run --restart=always --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7

docker run --name mysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8 \
--default-authentication-plugin=mysql_native_password \
--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

redis

1
2
3
4
docker run -v /opt/docker/redis/:/opt/redis/ --name redis -p 6379:6379 redis redis-server /opt/redis/redis.conf

docker run --name redis -p 6379:6379 -d --restart=always redis redis-server --appendonly yes --requirepass "123456"