Hello everyone. How can you put 2 identical images on the same local machine, albeit with different names and in different folders, respectively. And create 2 containers with different parameters from them? The system on Ubuntu 20.4
Good evening and welcome,
I’m a little confused about the “different folders”. So the following text might not be matching your expectation because I got it wrong.
Do you mean the following?
You have two image-tags A-tag
and B-tag
with the same image-hash (= both are the same image).
You have two folders a-dir
and b-dir
with a docker-compose.yml
located in each folder where a-dir/docker-compose.yml
uses image-tag A
and the b-dir/docker-compose.yml
uses the image-tag B
.
If you startup both containers by running docker-compose up -d
within each directory a-dir
and b-dir
two containers with different names are created and started.
This will work - except when both containers created by the docker-compose up -d
within each directory should be accessible on the same tcp-port from the outside-world.
There is no need two have two tags for the same image as it is normal to use the same image-tag in different docker-compose.yml
-files. But there are cases where you want to have different image-tags for the same image.