Home > other >  /etc/hosts cannot commit
/etc/hosts cannot commit

Time:09-23

Everyone a great god, play docker, recently encountered a problem:

/etc/hosts to modify in the container, after the success of the save, commit to the container into a new image, but again with a new image created by the container/etc/hosts or initial state, no I do change, is this why? (modify hosts is to determine the effect, in the container)

CodePudding user response:


As a modification of other problems, submit test.


CodePudding user response:

Created this problem well, container, the three/etc/hosts file,/etc/resolv. Conf,/etc/hostname is mapping mount a host machine, not in the container, you can umount, then use a container, but to play when the mirror is not I in, will be ignored, you can write two scripts, in a mirror before execution, keep these files to another directory, another script, umount + these files after create the container return to it should be in the position, to write the script to ensure that the reentrant, because the container will restart often hang up

CodePudding user response:

Container in the/etc/hosts each will be launched initialization, can in the docker is added in the run - add - host name: IP
  • Related