I am trying to monitor and manage the containers (running in a default context) through docker desktop (in Ubuntu 22.04).I have gone through . However, the solution freeze the docker desktop and never restart after inserting { “default-context”: “default” } in Docker Engine. According to my understanding, the docker desktop is using a new context called “desktop-linux”.
I also tried with docker context use default which change the context to default (when i use docker run) but not showing anything to docker desktop GUI.
The official guideline tells “Docker Desktop on Linux runs a Virtual Machine (VM) which creates and uses a custom docker context, desktop-linux, on startup.”
Is there any way to manage (display, start, stop etc.)the containers (running in default context) through docker desktop ubuntu.
I have : Docker version 24.0.6, build ed223bc; Docker Engine V24.0.6; Docker Desktop Version 4.24.2
No, there is no way. If you need a GUI for other contexts, you can try Portainer. I personally don’t like it but it is popular among people who like GUIs.
Docker contexts are for the clients so it will not change how the GUI works. The context of Docker Desktop is a special context and Docker Desktop was never intended to manage other contexts, only its own virtual machine. The goal is to provide the same virtual machine for you and for the GUI so it works the same way everywhere. Well, that’s the goal, and isn’t always reality When Docker Desktop for Linux came out, I didn’t unerstand why a VM was necessary first, but it indeed makes it more stable, but not perfect.
This is the closest accepted solution I came up to copy the images from the default context to desktop-linux context.
Very simple script to copy images from one side to the other.
#!/bin/bash
# Function to save images to tar files
save_images() {
echo "Switching to default context..."
docker context use default
echo "Saving Docker images to tar files..."
for image in $(docker images -q); do
image_name=$(docker inspect --format='{{.RepoTags}}' $image | sed 's/[][]//g')
sanitized_image_name=$(echo $image_name | tr '/' '_' | tr ':' '_')
docker save "${image_name}" | gzip > "${sanitized_image_name}.tar.gz"
echo "Saved $image_name to ${sanitized_image_name}.tar.gz"
echo "----"
done
}
# Function to load images from tar files
load_images() {
echo "Switching to desktop-linux context..."
docker context use desktop-linux
echo "Loading Docker images from tar files..."
for file in *tar.gz; do
docker load --input $file
echo "Loaded image from $file"
done
}
return_to_context() {
docker context use default
}
delete_tars() {
echo "Deleting tars"
find . -name "*tar.gz" -type f -exec rm {} \; -print
}
# Main script execution
save_images
load_images
delete_tars
return_to_context
echo "All images have been moved from default context to desktop-linux context."