The created ID is machine and user specific, and it will differ from one launch from another. You must not rely on conatiner ID, instead, docker containers have names by which you can reference them.
When containerizing your application, you must first describe the image for your container. Image is created using Dockerfile and essentially is some sort of a binary file from which the docker can create containerized environment.
When you have the image (either on the host, or somewhere on the remote), you can run the container from it using docker run command:
After running the container, you can reference it by its name:
docker exec -it $CONTAINER bash
You can also stop the container:
docker container stop $CONTAINER
docker container ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5be658ff3baa ghcr.io/riscv-technologies-lab/rv_tools_image:1.0.1 "/bin/bash" 8 minutes ago Exited (137) About a minute ago rv_tools_experiments
When you want to rerun the container, you don't have to create it from the docker image again. The container is already created and simply need to be restarted:
https://github.com/Aliyaminim/karatsuba-multiplication/blob/0bf42bd39e0dd90f50f26e27f90d524e51111d00/Makefile#L7
The created ID is machine and user specific, and it will differ from one launch from another. You must not rely on conatiner ID, instead, docker containers have names by which you can reference them.
Take a look at following: https://docs.docker.com/get-started/
When containerizing your application, you must first describe the image for your container. Image is created using Dockerfile and essentially is some sort of a binary file from which the docker can create containerized environment.
When you have the image (either on the host, or somewhere on the remote), you can run the container from it using
docker run
command:After running the container, you can reference it by its name:
You can also stop the container:
When you want to rerun the container, you don't have to create it from the docker image again. The container is already created and simply need to be restarted: