How to Copy file to stopped docker container

前端 未结 4 2095
孤独总比滥情好
孤独总比滥情好 2021-02-18 21:04

I am running elasticsearch from within a docker container.

While configuring elasticsearch for ssl and shield my elasticsearch.yml file got illegal entry i

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-18 21:28

    replace it without losing data

    Ideally, those data should be stored in path mounted from separate data volume containers (which do not run, they are just created). That way, your main service container (the elasticsearch one) can crash and be replaced at will.
    In that configuration (mounting data from volume containers), you could rebuild your elasticsearch image with the new config file, and resume from there.

    In your current config, if those data are not in a VOLUME declared by your Dockerfile, what you can do is:

    • [docker commit ][1] newimage
    • make a Dockerfile using that newimage, and COPY the fixed config file
    • running your container from that new image.

提交回复
热议问题