docker-can';t更改文件(wso2)

docker-can';t更改文件(wso2),docker,wso2,Docker,Wso2,我正在使用docker 18.04并运行wso2物联网服务器。我想使用本教程更改ip地址。我正在使用附加的docker compose文件。我正在使用创建一个容器 sudo docker-compose up 然后我就跑 sudo -it -u 0 <container-id> bash 所有已丢弃的更改。但奇怪的是,如果我创建一个新的文件e。G在conf目录中,即使重新启动,该文件仍保留。 有人能给我解释一下吗 version: '2.3' services: wso2io

我正在使用docker 18.04并运行wso2物联网服务器。我想使用本教程更改ip地址。我正在使用附加的docker compose文件。我正在使用创建一个容器

sudo docker-compose up
然后我就跑

sudo -it -u 0 <container-id> bash
所有已丢弃的更改。但奇怪的是,如果我创建一个新的文件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

据我所知,在容器被删除之前,可写层应该是可用的。但这不是使用Docker的预期方式。在这种情况下,如果需要运行change ip脚本,我认为最好创建一个新的Docker映像,在Docker映像创建过程中执行change ip脚本

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