我正在使用docker 18.04并运行wso2 iot-server。我想使用本教程https://docs.wso2.com/display/IOTS330/Configuring+the+IP+or+Hostname更改ip-address。我使用附加的docker-compose文件。我正在使用
创建一个容器sudo docker-compose up
然后我跑
sudo -it -u 0 <container-id> bash
导航到脚本目录并执行脚本。
在像conf / carbon.xml这样的文件之后,其中一切都变好了。如果我重新启动容器执行
docker container restart $(docker ps -a -q)
丢弃的所有更改。但奇怪的是,如果我创建一个新文件e。 G。在conf目录中,即使重新启动,该文件仍然存在。 有人可以向我解释一下吗?
version: '2.3'
services:
wso2iot-mysql:
image: mysql:5.7.20
container_name: wso2iot-mysql
hostname: wso2iot-mysql
ports:
- 3306
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- ./mysql/scripts:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-uroot", "-proot"]
interval: 10s
timeout: 60s
retries: 5
wso2iot-broker:
image: wso2iot-broker:3.3.0
container_name: wso2iot-broker
hostname: wso2iot-broker
ports:
- "9446:9446"
- "5675:5675"
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "9446"]
interval: 10s
timeout: 120s
retries: 5
depends_on:
wso2iot-mysql:
condition: service_healthy
volumes:
- ./broker:/home/wso2carbon/volumes/wso2/broker
wso2iot-analytics:
image: wso2iot-analytics:3.3.0
container_name: wso2iot-analytics
hostname: wso2iot-analytics
healthcheck:
test: ["CMD", "curl", "-k", "-f", "https://localhost:9445/carbon/admin/login.jsp"]
interval: 10s
timeout: 120s
retries: 5
depends_on:
wso2iot-mysql:
condition: service_healthy
volumes:
- ./analytics:/home/wso2carbon/volumes/wso2/analytics
ports:
- "9445:9445"
wso2iot-server:
image: wso2iot-server:3.3.0
container_name: wso2iot-server
hostname: wso2iot-server
healthcheck:
test: ["CMD", "curl", "-k", "-f", "https://localhost:9443/carbon/admin/login.jsp"]
interval: 10s
timeout: 120s
retries: 5
depends_on:
wso2iot-mysql:
condition: service_healthy
volumes:
- ./iot-server:/home/wso2carbon/volumes
ports:
- "443:9443"
links:
- wso2iot-mysql
答案 0 :(得分:0)
据我所知,在删除容器之前,可写层应该可用。但这不是使用Docker的预期方式。在这种情况下,如果您需要运行change-ip脚本,我认为最好创建一个新的Docker映像,在Docker映像创建过程中执行change-ip脚本。