xiaoming728

xiaoming728

Docker 常用软件安装命令

2023-12-11
Docker 常用软件安装命令

tomcat

docker run -d -p 8080:8080 \
-v /home/docker/tomcat/webapps:/usr/local/tomcat/webapps \
-v /home/docker/tomcat/logs:/usr/local/tomcat/logs \
-v /home/docker/tomcat/conf:/usr/local/tomcat/conf \
--name tomcat \
--restart=always \
tomcat:6.0.41

portainer

docker run -d -p 8000:8000 -p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /home/docker/portainer:/data \
--name=portainer \
--restart=always \
portainer/portainer-ce

redis

docker run -d -p 6379:6379 \
    -v /home/docker/redis/data:/data \
    --name redis \
    --restart=always \
     redis redis-server \
    --appendonly yes \
    --requirepass "Linewell@redis"

jenkins

docker run -d -p 8080:8080 -p 50000:50000 -u root \
  -v /home/docker/jenkins:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /home/docker/jenkins/.m2:/root/.m2 \
  -v /etc/localtime:/etc/localtime \
  --name jenkins \
  --restart=always \
  jenkinsci/blueocean

nginx

docker run -d -p 80:80 \
    -v /home/docker/nginx/html:/usr/share/nginx/html \
    -v /home/docker/nginx/conf.d:/etc/nginx/conf.d \
    -v /home/docker/nginx/logs:/var/log/nginx \
    --name nginx \
    --restart=always \
    nginx

zookeeper

docker run -d -p 2181:2181 \
   -v /home/docker/zookeeper/data:/data \
   -v /home/docker/zookeeper/logs:/logs \
   -v /home/docker/zookeeper/datalog:/datalog \
   --name zookeeper \
   --restart=always \
   zookeeper:latest

kafka

docker run -d --restart=always --name kafka -p 9092:9092 \
--link zookeeper \
--env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
--env KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 \
--env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://192.168.206.183:9092 \
-v /etc/localtime:/etc/localtime \
-v /home/docker/kafka/data:/kafka \
-v /home/docker/kafka/logs:/opt/kafka/logs \
wurstmeister/kafka

docker cp kafka:/opt/kafka/config /home/docker/kafka/config

docker stop kafka

docker run -d --restart=always --name kafka -p 9092:9092 \
--link zookeeper \
--env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
--env KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 \
--env KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://192.168.206.180:9092 \
-v /etc/localtime:/etc/localtime \
-v /home/docker/kafka/data:/kafka \
-v /home/docker/kafka/config:/opt/kafka/config \
-v /home/docker/kafka/logs:/opt/kafka/logs \
wurstmeister/kafka