Skip to main content

Essential Docker Commands for Middleware Container Setup

This guide provides a concise list of essential Docker commands to efficiently set up your Middleware gitlab sync agent docker container.

🟣 Key Docker Commands​

CommandDescription
docker compose up -dPull and runs all the docker containers necessary defined in the docker-compose.yml file
docker compose down -vRemoves all the containers defined in the docker-compose.yml file along with their volume mappings. Use this to start fresh.
docker psLists running containers
docker stop <container-id>Stops a running container
docker start <container-id>Starts a stopped container
docker restart <container-id>Restarts a container
docker rm <container-id>Removes a stopped container
docker imagesLists all images on your system
docker rmi -f <image-id>Removes an image from your system
docker exec -it <container-id> /bin/bashExecutes a shell inside a running container, which can be used for debugging and troubleshooting

🟣 Updating to a new docker image​

You have a container running already but want to update to the latest version of the image. Do the following:

  1. Stop the running containers: docker compose down
  2. List out all the images: docker images -a
  3. Find the older image and copy that image’s id
  4. Delete the older image: docker rmi -f <image-id>
  5. Run docker compose up -d to fetch the latest image and start the agent again.

🟣 Adding more gitlab projects to sync​

You want to sync more projects with Middleware. Do the following:

  1. Edit your config.json file and add to the list of projects.
  2. List the container: docker ps
  3. Grab the id of the public.ecr.aws/y4x5l0o7/mhq-sync-scripts:latest container
  4. Restart your docker container: docker restart <container-id>

🟣 Run sync immediately​

You want to run sync immediately. Do the following:

  1. docker restart <container-id>