allow insecure registry in host provisioned with docker-machine

前端 未结 5 578
一整个雨季
一整个雨季 2021-01-30 06:58

Is there anyway to configure --allow-insecure-ssl for docker\'s deamon created with docker-machine.

commands:

docker-ma         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 07:48

    env :

    • docker daemon :1.12.3
    • docker client :1.12.2
    • docker api :1.24
    • docker-machine :0.8.2

    Before create machine

    you can use the args to set one or multi insecure registry and registry mirrors .eg:

    one registry

    docker-machine create -d virtualbox --engine-insecure-registry hostname:5000  --engine-registry-mirror http://hostname:5000 n1
    

    multi registrys

    docker-machine create -d virtualbox --engine-insecure-registry hostname:5000 --engine-insecure-registry hostname:5001  --engine-registry-mirror http://hostname:5000 n1
    

    After create the machine

    you can edit the /var/lib/boot2docker/profile to add the registrys and mirrors

    docker-machine ssh [machine-name]
    vi /var/lib/boot2docker/profile
    

    add the registry and mirrors to the EXTRA_ARGS

    EXTRA_ARGS='
    --label provider=virtualbox
    --insecure-registry hostname:5000
    --insecure-registry hostname:5001
    --registry-mirror   http://hostname:5000
    --registry-mirror   http://hostname:5001
    

    now you need to restart the machine and check it

    docker-machine restart [machine-name] 
    docker info 
    

    this method doesn`t work after create the machine

    edit $USER/.docker/machine/machines/default/config.json

    "EngineOptions": {
        "InsecureRegistry": [
            "XXX.XXX.virtual"
        ],
    }
    

提交回复
热议问题