不同范围的ip地址whit docker容器已恢复

时间:2016-05-09 06:32:18

标签: mysql docker

我没有找到如何更改从其他主机导入的容器泊坞窗中的IP地址。 以前我保存我的容器docker与mysql数据库与tar文件,docker版本1.11.1,IP范围172.17.0.X(如果我停止并启动容器IP地址更改)。然后在新主机和相同版本的docker中,但现在范围是172.17.42.X. 我需要可以管理范围ip docker,但选项“--ip = 172.17.0.X”没有运行。 如何在不同主机中导出导入容器的过程正确?

Thans

1 个答案:

答案 0 :(得分:0)

在我看来,当我们在不同主机之间导出容器时,我们不能在配置中使用ip地址。我们必须使用链接功能来允许容器相互发现。例如,连接两个容器(mysql和webapp):

    ["UIImagePickerControllerOriginalImage": <UIImage: 0x17f587d0> size {2448, 3264} orientation 3 scale 1.000000, "UIImagePickerControllerMediaMetadata": {
DPIHeight = 72;
DPIWidth = 72;
Orientation = 6;
"{Exif}" =     {
    ApertureValue = "2.526068811667587";
    BrightnessValue = "0.8999723109936938";
    ColorSpace = 1;
    DateTimeDigitized = "2016:05:09 15:48:39";
    DateTimeOriginal = "2016:05:09 15:48:39";
    ExposureBiasValue = 0;
    ExposureMode = 0;
    ExposureProgram = 2;
    ExposureTime = "0.05";
    FNumber = "2.4";
    Flash = 24;
    FocalLenIn35mmFilm = 33;
    FocalLength = "4.12";
    ISOSpeedRatings =         (
        320
    );
    LensMake = Apple;
    LensModel = "iPhone 5 back camera 4.12mm f/2.4";
    LensSpecification =         (
        "4.12",
        "4.12",
        "2.4",
        "2.4"
    );
    MeteringMode = 5;
    PixelXDimension = 3264;
    PixelYDimension = 2448;
    SceneType = 1;
    SensingMethod = 2;
    ShutterSpeedValue = "4.321956949076723";
    SubjectArea =         (
        1631,
        1223,
        1795,
        1077
    );
    SubsecTimeDigitized = 508;
    SubsecTimeOriginal = 508;
    WhiteBalance = 0;
};
"{MakerApple}" =     {
    1 = 4;
    20 = 1;
    3 =         {
        epoch = 0;
        flags = 1;
        timescale = 1000000000;
        value = 17977926382791;
    };
    4 = 0;
    5 = 221;
    6 = 210;
    7 = 1;
    8 =         (
        "-0.0007734549",
        "-0.9098752",
        "-0.3961896"
    );
};
"{TIFF}" =     {
    DateTime = "2016:05:09 15:48:39";
    Make = Apple;
    Model = "iPhone 5";
    ResolutionUnit = 2;
    Software = "9.2.1";
    XResolution = 72;
    YResolution = 72;
};
 }, "UIImagePickerControllerMediaType": public.image]

另一方面,如果您想使用172.17.0.X范围内的旧IP地址,则必须在运行容器之前将此网络添加到新的docker主机

$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
$ docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql