docker run 과 docker - compose 변환
9450 단어 docker
nginx:192.168.8.2 docker run –restart=always –privileged –network br0 –ip 192.168.8.2 -p 80:80 –name mynginx -v PWD/www:/www−v PWD/conf/nginx.conf:/etc/nginx/nginx.conf -v $PWD/logs:/wwwlogs -d nginx:1.12.1
redis:192.168.8.9 docker run –restart=always –privileged –network br0 –ip 192.168.8.9 -p 7379:6379 –name myredis -v $PWD/data:/data -d redis:3.2.10 redis-server –appendonly yes
mysql:192.168.8.4 docker run –restart=always –privileged –network br0 –ip 192.168.8.4 -p 3306:3306 –name mymysql -v PWD/conf/my.cnf:/etc/mysql/my.cnf−v PWD/logs:/logs -v $PWD/data:/mysql_data -e MYSQL_ROOT_PASSWORD=root@hiekn -d mysql:5.6.37
tomcat:192.168.8.3 docker run –restart=always –privileged –network br0 –ip 192.168.8.3 -p 8080:8080 –name mytomcat -v PWD/projectlogs:/work/tomcat/projectlogs−v PWD/logs:/work/tomcat/logs -v $PWD/webapps:/work/tomcat/webapps -d tomcat
mongo:192.168.8.6 docker run –restart=always –privileged –network br0 –ip 192.168.8.6 -p 27017:27017 –name mymongo -v $PWD/db:/data/db -d mongo:3.4.6
elasticsearch:192.168.8.7 docker run –restart=always –privileged –network br0 –ip 192.168.8.7 -p 9200:9200 -p 9300:9300 –name myes -v PWD/data:/work/elasticsearch−5.5.1/data−v PWD/config/elasticsearch.yml:/work/elasticsearch-5.5.1/config/elasticsearch.yml -v $PWD/logs:/work/elasticsearch-5.5.1/logs -d elasticsearch
registry:192.168.8.100 docker run –restart=always –privileged –network br0 –ip 192.168.8.100 -p 5000:5000 –name hiekn_registry -v /work/registry:/var/lib/registry -d registry
SSE:192.168.8.8 docker run –restart=always –privileged –network br0 –ip 192.168.8.8 -p 8081:8080 –name mysse -v PWD/projectlogs:/work/tomcat/projectlogs−v PWD/logs:/work/tomcat/logs -v $PWD/webapps:/work/tomcat/webapps -d tomcat
plantdata_nginx:192.168.8.10 docker run –restart=always –privileged –network br0 –ip 192.168.8.10 -p 81:80 –name plantdata_nginx -v PWD/www:/www−v PWD/conf/nginx.conf:/etc/nginx/nginx.conf -v $PWD/logs:/wwwlogs -d nginx:1.12.1
plantdata_redis:192.168.8.5 docker run –restart=always –privileged –network br0 –ip 192.168.8.5 -p 6379:6379 –name plantdata_redis -v $PWD/data:/data -d redis:3.2.10 redis-server –appendonly yes
사용 - privileged?진짜 루트 권한!CentOS 7 의 보안 모듈 selinux 가 권한 을 금 지 했 습 니 다. setenforce 0 을 임시 닫 고 수정 / etc / sysconfig / selinux 파일 SELINUX = disabled 를 영구적 으로 닫 습 니 다.
2. docker - compose 사용
version: '2.1'
services:
nginx:
image: docker.io/nginx:1.12.1
container_name: mynginx
restart: always
networks:
app_net:
ipv4_address: 192.168.8.2
ports:
- "80:80"
volumes:
- /work/nginx/www:/www
- /work/nginx/logs:/wwwlogs
- /work/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
db:
image: docker.io/mysql:5.6.37
container_name: mymysql
restart: always
networks:
app_net:
ipv4_address: 192.168.8.4
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
volumes:
- /work/mysql/data:/mysql_data
- /work/mysql/logs:/logs
- /work/mysql/conf/my.cnf:/etc/mysql/my.cnf
redis:
image: docker.io/redis:3.2.10
container_name: myredis
restart: always
command: ["redis-server" ,"--appendonly" ,"yes"]
networks:
app_net:
ipv4_address: 192.168.8.9
ports:
- "7379:6379"
volumes:
- /work/myredis/data:/data
mongo:
image: docker.io/mongo:3.4.6
container_name: mymongo
restart: always
networks:
app_net:
ipv4_address: 192.168.8.6
ports:
- "27017:27017"
volumes:
- /work/mongo/db:/data/db
nginx2:
image: docker.io/nginx:1.12.1
container_name: plantdata_nginx
restart: always
networks:
app_net:
ipv4_address: 192.168.8.10
ports:
- "81:80"
volumes:
- /work/plantdata_nginx/www:/www
- /work/plantdata_nginx/logs:/wwwlogs
- /work/plantdata_nginx/conf/nginx.conf:/etc/nginx/nginx.conf
es:
image: elasticsearch:5.5.1
container_name: myes
restart: always
mem_limit: 2G
networks:
app_net:
ipv4_address: 192.168.8.7
ports:
- "9200:9200"
- "9300:9300"
volumes:
- /work/elasticsearch/config/elasticsearch.yml:/work/elasticsearch-5.5.1/config/elasticsearch.yml
- /work/elasticsearch/data:/work/elasticsearch-5.5.1/data
- /work/elasticsearch/logs:/work/elasticsearch-5.5.1/logs
reids2:
image: docker.io/redis:3.2.10
container_name: plantdata_redis
restart: always
command: ["redis-server" ,"--appendonly" ,"yes"]
networks:
app_net:
ipv4_address: 192.168.8.5
ports:
- "6379:6379"
volumes:
- /work/myredis/data:/data
tomcat2:
image: tomcat:8.0.45
container_name: mysse
restart: always
networks:
app_net:
ipv4_address: 192.168.8.8
ports:
- "8081:8080"
depends_on:
- mongo
volumes:
- /work/sse/webapps:/work/tomcat/webapps
- /work/sse/project_logs:/work/tomcat/project_logs
- /work/sse/logs:/work/tomcat/logs
tomcat:
image: tomcat:8.0.45
container_name: mytomcat
restart: always
networks:
app_net:
ipv4_address: 192.168.8.3
ports:
- "8080:8080"
depends_on:
- db
- redis
volumes:
- /work/tomcat/webapps:/work/tomcat/webapps
- /work/tomcat/project_logs:/work/tomcat/project_logs
- /work/tomcat/logs:/work/tomcat/logs
hiekn_registry:
image: docker.io/registry
container_name: hiekn_registry
restart: always
networks:
app_net:
ipv4_address: 192.168.8.100
ports:
- "5000:5000"
volumes:
- /work/registry:/var/lib/registry
networks:
app_net:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 192.168.8.0/24
gateway: 192.168.8.1
- subnet: 2001:3984:3989::/64
gateway: 2001:3984:3989::1
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Swarm의 도커 비밀이 게시물에서는 Redis를 사용한 실제 시나리오 예제를 제공하여 사용 방법을 보여주고자 합니다. Docker 기술에 대한 기본 지식 Docker Swarm 오케스트레이터에 대한 기본 지식 "Docker Swarm ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.