diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 01fd0ea4..3717e8b0 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1365,6 +1365,7 @@ buildvariants: display_name: Docker run_on: - ubuntu2204-small + - macos-14 tasks: - ".docker" # Run all tasks with the "docker" tag diff --git a/.evergreen/docker/README.md b/.evergreen/docker/README.md index 18c4e7f0..b610b516 100644 --- a/.evergreen/docker/README.md +++ b/.evergreen/docker/README.md @@ -1,12 +1,11 @@ # Drivers Evergreen Tools Dockerfile -The `Dockerfile` and scripts can be used to run a local server in docker container. +The `Dockerfile` and scripts can be used to run a local server in a container. -Additionally, you can build a Docker [container](#driver-testing-using-this-docker-container) +Additionally, you can build a [container](#driver-testing-using-this-container) for your Driver that shares the binary files and communicates with this container. -You will need Docker (or podman aliased to Docker) installed and running -locally. +You will need podman (or Docker) installed and running locally. # Run Local Server @@ -16,11 +15,11 @@ To run a local server, change to this directory and run: bash ./run-server.sh ``` -This will build the docker image and run it with appropriate settings. +This will build the container image and run it with appropriate settings. Note that any of the environment variables used by `run-orchestration` will be passed through to the container. The appropriate port(s) will be exposed, allowing you to run local test against -the running docker container. +the running container. The default image can be overridden with `IMAGE`, and the entrypoint with `ENTRYPOINT`. To use a specific architecture, use `PLATFORM`, e.g. `--platform linux/amd64`. @@ -61,20 +60,20 @@ ARCH=amd64 TOPOLOGY=sharded_cluster MONGODB_VERSION=3.6 TARGET_IMAGE=ubuntu18.04 ### Get Logs -The orchestration logs can be found using `docker logs`: +The orchestration logs can be found using `podman logs`: ```bash -docker logs mongodb +podman logs mongodb ``` The server logs can be found on the container in /tmp, with the scheme `/tmp/mongo-/mongo.log`. -You can pull them locally using `docker cp`: +You can pull them locally using `podman cp`: ```bash -docker cp mongodb:/tmp/mongo-27017/mongod.log mongod.log +podman cp mongodb:/tmp/mongo-27017/mongod.log mongod.log ``` -## Driver Testing using this Docker container +## Driver Testing using this container First, start this container with the appropriate environment variables, running as: diff --git a/.evergreen/docker/run-server.sh b/.evergreen/docker/run-server.sh index 8a95f5d0..3adcc72d 100755 --- a/.evergreen/docker/run-server.sh +++ b/.evergreen/docker/run-server.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Run a local MongoDB orchestration inside a docker container +# Run a local MongoDB orchestration inside a container # set -eu @@ -18,9 +18,18 @@ if [[ -z $PLATFORM && -n $ARCH ]]; then PLATFORM="--platform linux/$ARCH" fi +if command -v podman &> /dev/null; then + DOCKER=podman +else + DOCKER=docker +fi +if [ -n "${DOCKER_COMMAND:-}" ]; then + DOCKER=$DOCKER_COMMAND +fi + pushd $SCRIPT_DIR USER="--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)" -docker build $PLATFORM -t $NAME $USER $IMAGE +$DOCKER build $PLATFORM -t $NAME $USER $IMAGE popd pushd $DRIVERS_TOOLS @@ -71,7 +80,7 @@ test -t 1 && ARGS+=" -t" # Map in the DRIVERS_TOOLS directory. ARGS+=" -v `pwd`:/root/drivers-evergreen-tools" -# Launch server docker container. -docker run $ARGS $NAME $ENTRYPOINT +# Launch server container. +$DOCKER run $ARGS $NAME $ENTRYPOINT popd