From fd94ec1d6b3780babaca2724a48f9dba12756cda Mon Sep 17 00:00:00 2001 From: beierlm Date: Fri, 29 Jan 2021 12:45:19 -0500 Subject: [PATCH] Correcting Syntax for Docker Updates the syntax for the sed scripts so that the DOCKER_PROXY_URL is correctly expanded Change Makefile so docker images are pushed to gitlab, not dockerhub Change-Id: I6cd66711de8fc79146613aa84d79ca234e6d17c1 Signed-off-by: beierlm --- docker/mk/Makefile.include | 5 +++-- installers/full_install_osm.sh | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docker/mk/Makefile.include b/docker/mk/Makefile.include index e1517483..995cbdf2 100644 --- a/docker/mk/Makefile.include +++ b/docker/mk/Makefile.include @@ -26,6 +26,7 @@ RELEASE ?= ReleaseEIGHT-daily REPOSITORY_KEY ?= OSM%20ETSI%20Release%20Key.gpg REPOSITORY ?= testing NO_CACHE ?= --no-cache +DOCKER_REGISTRY ?= "" LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]') @@ -81,7 +82,7 @@ clean: rm -f $(MKBUILD)/.dep* tag: - docker tag opensourcemano/$(CONTAINER_NAME):$(INPUT_TAG) opensourcemano/$(LOWER_MDG):$(TAG) + docker tag opensourcemano/$(CONTAINER_NAME):$(INPUT_TAG) $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG) push: tag - docker push opensourcemano/$(LOWER_MDG):$(TAG) + docker push $(DOCKER_REGISTRY)opensourcemano/$(LOWER_MDG):$(TAG) diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index c4141dbf..b92d6adf 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -218,7 +218,7 @@ function uninstall_lightweight() { remove_stack osm_elk fi echo "Now osm docker images and volumes will be deleted" - # TODO: clean-up of images should take into account if other tags were used for specific modules + # TODO: clean-up of images should take into account if other tags were used for specific modules newgrp docker << EONG for module in ro lcm keystone nbi mon pol pla osmclient; do docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${OSM_DOCKER_TAG} @@ -404,16 +404,16 @@ function install_docker_ce() { echo "Configuring docker proxy ..." if [ -f /etc/docker/daemon.json ]; then if grep -q registry-mirrors /etc/docker/daemon.json; then - sudo sed -Ei 's/("registry-mirrors".*\[)(.*)\]/\1\2, \"'"${DOCKER_PROXY_URL}"'\"\]/' /etc/docker/daemon.json + sudo sed -i "s|registry-mirrors.*|registry-mirrors\": [\"${DOCKER_PROXY_URL}\"] |" /etc/docker/daemon.json else - sudo sed -i 's/{/{\n "registry-mirrors": [\"'"${DOCKER_PROXY_URL}"'\"]",/' /etc/docker/daemon.json + sudo sed -i "s|{|{\n \"registry-mirrors\": [\"${DOCKER_PROXY_URL}\"],|" /etc/docker/daemon.json fi else - sudo bash -c 'cat << EOF > /etc/docker/daemon.json + sudo bash -c "cat << EOF > /etc/docker/daemon.json { - "registry-mirrors": ["${DOCKER_PROXY_URL}"] + \"registry-mirrors\": [\"${DOCKER_PROXY_URL}\"] } -EOF' +EOF" fi sudo systemctl daemon-reload sudo service docker restart @@ -570,11 +570,11 @@ function generate_docker_images() { if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then continue fi - module_tag="${OSM_DOCKER_TAG}" + module_tag="${OSM_DOCKER_TAG}" if [ -n "${MODULE_DOCKER_TAG}" ] && echo $TO_REBUILD | grep -q $module ; then module_tag="${MODULE_DOCKER_TAG}" fi - echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image" + echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image" sg docker -c "docker pull ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag}" || FATAL "cannot pull $module docker image" done else -- 2.25.1