Docker Community Forums

Share and learn in the Docker community.

Migrate to Docker CE for Linux to Docker CE for Windows


(Tom) #1

Currently I have in Linux some .sh scripts that run compose.yml and Dockerfile, as well as some system variables.
Is it possible to migrate these scripts to be running in Docker CE in Windows 10 Pro through PowerShell?

We’ve already tried using Docker over WSL in Windows, but it adds an extra layer of complexity to the job and it’s not ideal for work.

These are my scripts that I do not know how to migrate to Windows 10.

This is not a problem linked to Docker, just my way of working.

variables.sh

#!/bin/bash    
export REPO=$(basename $(git rev-parse --show-toplevel))
export BRANCH=$(git symbolic-ref --short HEAD)
export TAG=${BRANCH//[^a-zA-Z0-9\-]/_}

export IMAGE=example/${REPO}:${TAG}
export PROJECT_NAME=${REPO}_${TAG}

run_dev.sh

#!/bin/bash

source ./docker/bin/variables

echo "[run_dev] calling /run_build"
./docker/bin/run_build --no-rebuild

echo "[run_dev] starting docker-compose for docker/compose.yml"
docker-compose --file=./docker/compose.yml up -d --force-recreate

echo "[run_dev] attaching to bash on $PROJECT_NAME"
(docker exec -it $PROJECT_NAME bash)

echo "[run_dev] tearing down docker/compose.dev.yml"
docker-compose --file=./docker/compose.yml down

echo "[run_dev] done"

run_build.sh

#!/bin/bash

source ./docker/bin/variables

REBUILD=true
if [[ $* == *--no-rebuild* ]]; then
  if docker history -q $IMAGE >/dev/null 2>&1; then
    echo "[run_build] will not rebuild image $IMAGE"
    REBUILD=false
  fi
fi

if $REBUILD; then

  echo "[run_build] start docker image build"

  docker build -t $IMAGE -f ./docker/Dockerfile .

  echo "[run_build] docker image build finished"

fi