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​
Command | Description |
---|---|
docker compose up -d | Pull and runs all the docker containers necessary defined in the docker-compose.yml file |
docker compose down -v | Removes all the containers defined in the docker-compose.yml file along with their volume mappings. Use this to start fresh. |
docker ps | Lists 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 images | Lists all images on your system |
docker rmi -f <image-id> | Removes an image from your system |
docker exec -it <container-id> /bin/bash | Executes 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:
- Stop the running containers:
docker compose down
- List out all the images:
docker images -a
- Find the older image and copy that image’s id
- Delete the older image:
docker rmi -f <image-id>
- 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:
- Edit your
config.json
file and add to the list of projects. - List the container:
docker ps
- Grab the id of the
public.ecr.aws/y4x5l0o7/mhq-sync-scripts:latest
container - Restart your docker container:
docker restart <container-id>
🟣 Run sync immediately​
You want to run sync immediately. Do the following:
- docker restart <container-id>