Merge pull request #1230 from openziti/fix_docker_race_condition

Fix docker race condition
This commit is contained in:
Geoff Berl
2023-08-10 16:14:51 -04:00
committed by GitHub
4 changed files with 18 additions and 3 deletions
+3
View File
@@ -15,17 +15,20 @@ First, decide what you are trying to do. Are you trying to:
1. copy the `ziti` CLI to `./ziti-bin`: `cp /path/to/ziti ./ziti-bin`
1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag
using the `ziti` CLI located in `./ziti-bin`
1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh <tagname>`
## Build Docker Image for Docker-related Changes
1. change to this directory from checkout root: `cd quickstart/docker`
1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag
using the latest `ziti` [release from GitHub](https://github.com/openziti/ziti/releases/latest)
1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh <tagname>`
## Build Docker Image with Specific ziti Version
1. change to this directory from checkout root: `cd quickstart/docker`
1. set `ZITI_VERSION_OVERRIDE` to desired version: `export ZITI_VERSION_OVERRIDE=v0.28.4`
1. run the script `./createLocalImage.sh` which will create a `openziti/quickstart:latest` tag
using the specified version of `ziti` [from GitHub](https://github.com/openziti/ziti/releases/tag/v0.28.4)
1. Optionally, you may provide an argument for the image tag. `./createLocalImage.sh <tagname>`
## ERROR: existing instance for "ziti-builder"
When running the `./createLocalImage.sh` script, you might get this error:
+1 -1
View File
@@ -17,4 +17,4 @@ else
echo ""
fi
$SCRIPT_DIR/pushLatestDocker.sh local
$SCRIPT_DIR/pushLatestDocker.sh local "${1}"
+7 -1
View File
@@ -12,6 +12,12 @@ if [[ "${ZITI_ROUTER_NAME-}" != "" ]]; then
echo "_ZITI_ROUTER_NAME set to: ${_ZITI_ROUTER_NAME}"
fi
# Wait until the file exists, then give one more second for the file to be completely written
until [ -f "${ZITI_HOME}/ziti.env" ]
do
sleep 1
done
sleep 1
. ${ZITI_HOME}/ziti.env
# wait for the controller to come online
@@ -48,7 +54,7 @@ if [ ! -f "${_UNIQUE_NAME}" ]; then
createPrivateRouterConfig "${ZITI_ROUTER_NAME}"
fi
found=$(ziti edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}")
found=$("${ZITI_BIN_DIR-}/ziti" edge list edge-routers 'name = "'"${ZITI_ROUTER_NAME}"'"' | grep -c "${ZITI_ROUTER_NAME}")
if [[ found -gt 0 ]]; then
echo "---------- Found existing edge-router ${ZITI_ROUTER_NAME}...."
else
+7 -1
View File
@@ -15,6 +15,12 @@ if [ -z "${ZITI_VERSION}" ]; then
exit 1
fi
IMAGE_TAG="${2-}"
if [ -z "${IMAGE_TAG}" ]; then
IMAGE_TAG="latest"
echo "image tag name was not provided, using default '${IMAGE_TAG}'"
fi
docker buildx create --use --name=ziti-builder
if [ "local" == "${1}" ]; then
@@ -28,5 +34,5 @@ fi
docker buildx build ${_BUILDX_PLATFORM} "${SCRIPT_DIR}/image" \
--build-arg ZITI_VERSION_OVERRIDE="v${ZITI_VERSION}" \
--tag "openziti/quickstart:${ZITI_VERSION}" \
--tag "openziti/quickstart:latest" \
--tag "openziti/quickstart:${IMAGE_TAG}" \
${_BUILDX_ACTION}