Get the old Docker images and containers back into operation

Good morning everyone,
I have 4 Docker images that I created many years ago for a very short course on this wonderful technology. I would like to put these codes back into operation to test my .war app built with IntelliJ.
I opened a program called “Kitematic (Alpha)” and after a few whims and a few blocks I started the blue console.
I try the following code but I don’t get the IP address that I have to type in the browser to read the .html file.
I believe that I have to uninstall the old program and put in a new version.
I would prefer to use the Windows console because Kitematic is slow to open. It’s possible?

D:
cd "D:\...\Docker-Apache-Server"
docker build -t apache_server:v1 .
docker run -d --name apache_server_container -p 8088:80 apache_server:v1
docker-machine ip

Dockerfile

FROM httpd:2.4
LABEL Author="Nome Cognome"
EXPOSE 80
COPY ./htdocs/ /usr/local/apache2/htdocs/

Kitematic

Windows PowerShell
Copyright (C) Microsoft Corporation. Tutti i diritti riservati.

Prova la nuova PowerShell multipiattaforma https://aka.ms/pscore6

PS C:\Program Files\Docker Toolbox> D:
PS D:\> cd "D:\...\DOCKER\Docker-Apache-Server"
PS D:\...\DOCKER\Docker-Apache-Server> docker build -t apache_server:v1 .
Sending build context to Docker daemon   12.8kB
Step 1/4 : FROM httpd:2.4
2.4: Pulling from library/httpd
1fe172e4850f: Pull complete
e2fa1fe9b1ec: Pull complete
60dd7398e74e: Pull complete
ea2ca81c6d4c: Pull complete
f646c69a26ec: Pull complete
Digest: sha256:e02a2ef36151905c790efb0a8472f690010150f062639bd8c0760e7b1e884c07
Status: Downloaded newer image for httpd:2.4
 ---> c30a46771695
Step 2/4 : LABEL Author="Nome Cognome"
 ---> Running in b0dfe58dd553
Removing intermediate container b0dfe58dd553
 ---> 85e4064bb458
Step 3/4 : EXPOSE 80
 ---> Running in 25b9561ae45b
Removing intermediate container 25b9561ae45b
 ---> 6f6070dbe781
Step 4/4 : COPY ./htdocs/ /usr/local/apache2/htdocs/
 ---> eb93fbcc2f63
Successfully built eb93fbcc2f63
Successfully tagged apache_server:v1
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
PS D:\...\DOCKER\Docker-Apache-Server> docker run -d --name apache_server_container -p 8088:80 apache_server:v1
8da7cfb1c55acbd6204040d50fe24b01ef0f451a33c9612f49d79f72b7530fdd
PS D:\...\DOCKER\Docker-Apache-Server> docker-machine ip
Error getting IP address: ssh command error:
command : ip addr show
err     : exit status 255
output  :
PS D:\...\DOCKER\Docker-Apache-Server> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
apache_server       v1                  eb93fbcc2f63        2 minutes ago       144MB
httpd               2.4                 c30a46771695        12 days ago         144MB
PS D:\...\DOCKER\Docker-Apache-Server> docker ps -a
CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS              PORTS                  NAMES
8da7cfb1c55a        apache_server:v1    "httpd-foreground"   2 minutes ago       Up 2 minutes        0.0.0.0:8088->80/tcp   apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker stop apache_server_container
apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker ps -a
CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS                     PORTS               NAMES
8da7cfb1c55a        apache_server:v1    "httpd-foreground"   4 minutes ago       Exited (0) 6 seconds ago                       apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker restart apache_server_container
apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker ps -a
CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS              PORTS                  NAMES
8da7cfb1c55a        apache_server:v1    "httpd-foreground"   4 minutes ago       Up 2 seconds        0.0.0.0:8088->80/tcp   apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker stop apache_server_container
apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker rm apache_server_container
apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker rmi apache_server:v1
Untagged: apache_server:v1
Deleted: sha256:eb93fbcc2f634c0d8690ad386020de57f4a1eb8955fe2b6f58f542c470d200e9
Deleted: sha256:a0a22dc93acd63dffc06e805c0f29e8a93f0649f9bff8f5163a17c83c88180f2
Deleted: sha256:6f6070dbe7811ac655de1260144038c8365ffba3f0684d1b5aafff4b89582b01
Deleted: sha256:85e4064bb458e4c5d3d046381a1f8f9320eaaae0a35b01ab319ae82067bcb73a
PS D:\...\DOCKER\Docker-Apache-Server> docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
PS D:\...\DOCKER\Docker-Apache-Server> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
httpd               2.4                 c30a46771695        12 days ago         144MB
PS D:\...\DOCKER\Docker-Apache-Server> docker rmi apache_server:v1
Error: No such image: apache_server:v1
PS D:\...\DOCKER\Docker-Apache-Server> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
httpd               2.4                 c30a46771695        12 days ago         144MB
PS D:\...\DOCKER\Docker-Apache-Server> docker stop apache_server_container
Error response from daemon: No such container: apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker rm apache_server_container
Error: No such container: apache_server_container
PS D:\...\DOCKER\Docker-Apache-Server> docker rmi apache_server:v1
Error: No such image: apache_server:v1
PS D:\...\DOCKER\Docker-Apache-Server> docker build -t apache_server:v1 .
Sending build context to Docker daemon   12.8kB
Step 1/4 : FROM httpd:2.4
 ---> c30a46771695
Step 2/4 : LABEL Author="Nome Cognome"
 ---> Running in 456d067b114d
Removing intermediate container 456d067b114d
 ---> 9b49c29d325c
Step 3/4 : EXPOSE 80
 ---> Running in 4d4a70a20a4c
Removing intermediate container 4d4a70a20a4c
 ---> 37b5f120f647
Step 4/4 : COPY ./htdocs/ /usr/local/apache2/htdocs/
 ---> 0f6c65336947
Successfully built 0f6c65336947
Successfully tagged apache_server:v1
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
PS D:\...\DOCKER\Docker-Apache-Server> docker run -d --name apache_server_container -p 8088:80 apache_server:v1
d6d78ea5fba14e2c508e0865b9a686edabee0e6cf84cd2d67433d5f27a99d731
PS D:\...\DOCKER\Docker-Apache-Server> docker-machine ip
Error getting IP address: ssh command error:
command : ip addr show
err     : exit status 255
output  :
PS D:\...\DOCKER\Docker-Apache-Server> docker stop $(docker ps -a -q)
d6d78ea5fba1
PS D:\...\DOCKER\Docker-Apache-Server> docker rm $(docker ps -a -q)
d6d78ea5fba1
PS D:\...\DOCKER\Docker-Apache-Server> docker system prune
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
PS D:\...\DOCKER\Docker-Apache-Server> docker system prune -a
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all images without at least one container associated to them
        - all build cache
Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: httpd:2.4
untagged: httpd@sha256:e02a2ef36151905c790efb0a8472f690010150f062639bd8c0760e7b1e884c07
untagged: apache_server:v1
deleted: sha256:0f6c6533694782bb267abdcfea13204ae418444357788644c8b241fe4f6985b0
deleted: sha256:bd0eb7a96d57e31fec29e351e9e2061a1cf59d414aae3e4ca9afa2cee922e053
deleted: sha256:37b5f120f647a9fb942747d480db4048d61f58ec522f6ef5b8794786a8ecfe29
deleted: sha256:9b49c29d325c6aca2a6b6a11b3274541c716ab15380b29b0fdb98674fb8d4279
deleted: sha256:c30a467716957ab3adabf990785d220056949d80b3aa46d90de3ea44d532b03e
deleted: sha256:3eddc6aae3c33ef2c7895bd28ab124090e476aa37ab213d26bd38b8082113472
deleted: sha256:1a013677ed69b4a61f582be290d1d787b6313fb561aa31e744577d5c968dae61
deleted: sha256:7565e71813b9092298c656a4b9f19491ee7305644acbb065bad35032417d02ea
deleted: sha256:be198b13c20a4fdb2ce343a00daa2a7ce72f82337e82dcf9332630db35fd9f01
deleted: sha256:9c1b6dd6c1e6be9fdd2b1987783824670d3b0dd7ae8ad6f57dc3cea5739ac71e

Total reclaimed space: 143.6MB
PS D:\...\DOCKER\Docker-Apache-Server> docker build -t apache_server:v1 .
Sending build context to Docker daemon   12.8kB
Step 1/4 : FROM httpd:2.4
2.4: Pulling from library/httpd
1fe172e4850f: Pull complete
e2fa1fe9b1ec: Pull complete
60dd7398e74e: Pull complete
ea2ca81c6d4c: Pull complete
f646c69a26ec: Pull complete
Digest: sha256:e02a2ef36151905c790efb0a8472f690010150f062639bd8c0760e7b1e884c07
Status: Downloaded newer image for httpd:2.4
 ---> c30a46771695
Step 2/4 : LABEL Author="Nome Cognome"
 ---> Running in 8336f48b8467
Removing intermediate container 8336f48b8467
 ---> cd88a376e842
Step 3/4 : EXPOSE 80
 ---> Running in 79afd8b4e451
Removing intermediate container 79afd8b4e451
 ---> 9bea0354f6a3
Step 4/4 : COPY ./htdocs/ /usr/local/apache2/htdocs/
 ---> 9e1dcfe1cb70
Successfully built 9e1dcfe1cb70
Successfully tagged apache_server:v1
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
PS D:\...\DOCKER\Docker-Apache-Server> docker run -d --name apache_server_container -p 8088:80 apache_server:v1
2276258ea3abee64148b1b930983edd63f65ff76f834b288b1ae96477dada08f
PS D:\...\DOCKER\Docker-Apache-Server> docker-machine ip
Error getting IP address: ssh command error:
command : ip addr show
err     : exit status 255
output  :
PS D:\...\DOCKER\Docker-Apache-Server> docker stop $(docker ps -a -q)
2276258ea3ab
PS D:\...\DOCKER\Docker-Apache-Server> docker rm $(docker ps -a -q)
2276258ea3ab
PS D:\...\DOCKER\Docker-Apache-Server> docker system prune
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
PS D:\...\DOCKER\Docker-Apache-Server> docker system prune -a
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all images without at least one container associated to them
        - all build cache
Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: apache_server:v1
deleted: sha256:9e1dcfe1cb7017fa483e48446dc82f7c3df4f49db045312a2344b8a4fb0722fd
deleted: sha256:d7ee2d1237f616608cd467369cbf9407a5f346c44d7b4a9c2ca28ac457af12f7
deleted: sha256:9bea0354f6a3684f610105188956d33ad4cf374aa7dbae9cbfe92ec04fb2173a
deleted: sha256:cd88a376e8420de63a9678267df642856837d372e1c4ca26e816d2b971ee9013
untagged: httpd:2.4
untagged: httpd@sha256:e02a2ef36151905c790efb0a8472f690010150f062639bd8c0760e7b1e884c07
deleted: sha256:c30a467716957ab3adabf990785d220056949d80b3aa46d90de3ea44d532b03e
deleted: sha256:3eddc6aae3c33ef2c7895bd28ab124090e476aa37ab213d26bd38b8082113472
deleted: sha256:1a013677ed69b4a61f582be290d1d787b6313fb561aa31e744577d5c968dae61
deleted: sha256:7565e71813b9092298c656a4b9f19491ee7305644acbb065bad35032417d02ea
deleted: sha256:be198b13c20a4fdb2ce343a00daa2a7ce72f82337e82dcf9332630db35fd9f01
deleted: sha256:9c1b6dd6c1e6be9fdd2b1987783824670d3b0dd7ae8ad6f57dc3cea5739ac71e

Total reclaimed space: 143.6MB
PS D:\...\DOCKER\Docker-Apache-Server>
PS D:\...\DOCKER\Docker-Apache-Server> docker stop $(docker ps -a -q)
"docker stop" requires at least 1 argument.
See 'docker stop --help'.

Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...] [flags]

Stop one or more running containers
PS D:\...\DOCKER\Docker-Apache-Server> docker rm $(docker ps -a -q)
"docker rm" requires at least 1 argument.
See 'docker rm --help'.

Usage:  docker rm [OPTIONS] CONTAINER [CONTAINER...] [flags]

Remove one or more containers
PS D:\...\DOCKER\Docker-Apache-Server> docker system prune
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
PS D:\...\DOCKER\Docker-Apache-Server> docker system prune -a
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all images without at least one container associated to them
        - all build cache
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
PS D:\...\DOCKER\Docker-Apache-Server>

A) I use VirtualBox, VMware and I cannot remove them. Do you recommend a working installation for my case since Docker Tolbox is deprecated?
B) Can Docker be installed on a Windows 11 Pro VM?

Yes, I would not try Docker Toolbox today. Docker Desktop is what you need or a virtual machine to run a Linux VM and install Docker on Linux. If you really want to install it on Windows, I think that should work even with having VirtualBox and VMWare on the same machine but it could be trickier to keep everything stable.
I had VirtualBox and Docker Desktop on the same machine and it worked… If I had any problem that was with virtualbox and in the and I had to uninstall it only because when I upgraded Windows 10 to Windows 11, it wasnt compatible with Windows anymore. It would probably work today with the latest stable version, but I am not sure.

I have Windows 11 Pro upgraded from Windows 10 Pro, so the OS should not be a problem, however, it would require nested virtualization since Docker would also start a virtual machine as a Linux container host. If you can set it up, you can try.

1 Like

Technicaly it is possible to install Docker Desktop for Windows and VirtualBox/VMware Workstation on the same machine. But…

Docker Desktop for Windows requires WSL, which in turn either uses full hyper-v (wsl1) or just some components of hyper-v (wsl2). This forces Vbox and VMware Workstation to run in the hyper-v compatibility mode, indicated by a green turtle in the buttom status bar of a VirtualBox vm. If your vm’s are headless the penelty might be bearable, but as soon as the vm’s run a gui the penellty is a party breaker.

I would strong recommend to install Ubuntu 20.04 in a Virtualbox or VMware Workstation vm and then install docker-ce from docker’s repositorties. Make sure to not install the docker.io package from Ubuntu’s repositories or the docker from snap.

On the other hand, if VBox already runs with a green turtle (as in is already in the hyper-v compatibility mode) you can use Docker Desktop for Windows without further penelty (as it already applied). There is a hole discussion to be made what actualy forces the hyper-v compatibility… the hyper-v feature enables it, the virtualization platform feature enables it, some *guard extensions enable it… There is a length discussion in the VBox forum - ofc VMware Workstation is effected in the same way.

1 Like

Thanks, I try to use Docker on Linux Ubuntu.
Can you recommend a 100% working guide?
A.If I want to use Docker on a real Linux server to publish a website created with Java, Tomcat and PostgreSQL do I have to pay or is it free as locally?
B.Can Docker also configure the real server to work with HTTPS?
C.Can Docker also configure the local server to work with unsigned HTTPS?
D.Can I also set up a domain name with Docker?

Are you refering to the docker installation? The official docs are just fine:

A) docker-ce itself is free of charge. You can find Images for Tomcat and PostgreSQL on dockerhub.

B-D) I am not sure what you think docker actualy does. It is “just” an isolation technique for processes with a little bit of “storage magic’” to manage images and containers in an efficient way + “network magic” to make to isolated process accessible from outside the isolation.

Thus said, can you please rephrase/extend on B-D?

Also, may I suggest this fabulous free self-paced docker training? Introduction to Containers
It should provide a solid foundation of the docker concepts and how it is used.

1 Like

I have rented a server in the past. The hosting provider has installed the Linux system on the server. In the following days I have installed Java, Tomcat and PostgreSQL. Finally I uploaded my .war file to the server.
The end result was this:

http://123.123.123.123:123/my-spring-boot-exercise

Everything worked fine but it took a long time, too long!
Here is a small example of what I did:
cloud.it/tutorial/how-install-apache-tomcat-su-ubuntu-18-04.aspx
I would like to redo all this work using Docker but I would like to do one more thing too:

https://www.mydomain.it/my-spring-boot-exercise

Locally I want to get this:

https://localhost:8443/it/

Can it all be done with Docker? Only a part? How much do you have to pay to do this with Docker?
The guide you sent me is very nice, thank you very much.
Today I try my old code on Linux.

I edited your post so the example URLs are not clickable and the third URL does not need to be altered to make it not clickable. Please use code blocks (</> button ) for URLs like these next time :slight_smile: The only URL I did not edit is the one that looks like a real website but it doesn’t work in the browser.

Why do you think you couldn’t? Metin was right in everything so I can just quote the most important part of the answer :slight_smile:

You need to configure your apps. Docker will not configure it for you.

Again, I quote Metin’s post:

“docker-ce” is what you install on a Linux machine. If a software requires you to pay for it, then you pay, doesn’t matter if it is running in a container or not. Otherwise it is free. I could imagine that a containerized version of a software would not be free because of its licence, but not because of Docker CE. I have never heard about anything like that though. Pay attention to the software licences and you will be alright

1 Like

@federicogalimberti please make yourself aquainted with buildpacks. If you created a template from https://start.spring.io/, you can use maven and the buildpacks plugin to create container images with: mvn spring-boot:build-image - I guess there is a similar build target for gradle as well. The build process already creates a “fat”-jar that embedds tomcat, there is no need to create a war and deploy it in a standalone tomcat.

Then it would be sufficient to just use buildpacks to package your spring boot application including all dependencies (incl. runtimes) as a container image and use the postgres image to create a postgres container.

Otherwise there is not much difference between running the process on the host or inside a container.
You will need to lern and understand the concepts that spring boot provides for configuration - it is quite flexible.

regarding dns-name: this needs to be done wherever you have the hosted zone for the domain - this is not the reponsibility of docker.
regarding context path: this is done in the configuration of the spring-boot application - this is not the responsibility of docker.

1 Like

What is the modern method of getting the IP and port the docker containers are on?
I seem to remember that this string was indispensable ‘sudo snap install docker’. Is this still the case today or is there a better system?
I used this ‘docker-machine ip’ command but it doesn’t work anymore.

giove@Ubuntu-22:~/Dropbox/SERVER/DOCKER-LINUX/Docker-Apache-Server$ docker-machine ip
docker-machine: comando non trovato
giove@Ubuntu-22:~/Dropbox/SERVER/DOCKER-LINUX/Docker-Apache-Server$

I strongly recommend you to use Google and the Docker documentation to get an answer quickly for basic questions like this. Search for “docker get ip address” and you will find many answers. The short answer is that you need the docker inspect command.
Also start to read what Metin suggested.

The first 16 pages are the table of content in which you find “networking” and “inspecting” too. Page 348 is “Finding the containers IP address”.

It has nothing to do with getting the IP address. It is installing Docker with the snap package manager which is not recommended.

2 Likes

Thanks for the answer but I’m very worried and anxious because the old code I used doesn’t work anymore.
I would like to ask you one more question if possible.
Code 1 / IP1 - 172.17.0.1
docker inspect --format='{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' apache_server_container
Code 2 / IP2 - 172.17.0.2
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' apache_server_container
I struggle to understand the Docker network well because I’m not a systems engineer.

  1. IP1 is the public IP of the Apache server and therefore the URL to type in the browser to view the website?
  2. Is IP1 the IP communicated to the DNS?
  3. Is IP2 the IP of Docker’s private network?
  4. Could you explain to me in a simple way (I’m not a systems engineer) why Docker needs an internal network in addition to an external network? Could you explain to me why a resource must have 2 IPs?
  5. IP2 only works on my Ubuntu server, right? If the client types IP2 on Windows 11 it doesn’t see anything, right?

However, I am very happy to see my container working. A huge hug for your help and your patience.

First of all, I have to quote again:

It shows you exactly how you can find the IP address which is IPAddress and not Gateway, but let’s go to your questions.

  1. No. IP1 is a gateway as the name of the property tells us. I’ll explain it later, but if you try to access your apache server inside the container using that port, you will find that it doesn’t work.
  2. I am not sure I understand this question, but the answer is probably no, because this IP is not really configured in any DNS in the sense that I think you think of it now.
  3. No. It is not a network, but if you meant it is an IP address from Docker’s private network, then yes.
  4. It is not internal and external. The gateway is a computer which has access to multiple network even though your workstation or server has only one network. Without a gateway you would not be able to communicate any computer outside the network of the server. Imagine how you could (not) download anything from the internet. Since Docker has its private network, you need a gateway. So IP1 is actually the IP address of your host machine in Docker’s private network.
  5. Yes.

When I recommend you to use Google I DO NOT mean that I don’t want to help you and I DO NOT mean that I expect you to be an engineer. I recommend it because we all do it often when we need help or we need to help someone else, because it is much faster than waiting for someone to tell us the answer. There is a really good chance that you will understand what you find. If you don’t, you can still ask for help sharing the link and we can interpret it for you. It is a good way to start with the expression “What is a…” on Google or on any of the search ngines you like.

Search for: What is a gateway
The first result: https://whatismyipaddress.com/gateway

I think this is a very good explanation with examples that don’t require an engineer to understand. Notice the one with the internet connection which I mentioned too.

You need to be familiar with some technical expressions if you want to work with Docker. You will probably find many more concept that might be new for you. If you really want to do it, keep your web browser and search engine close to you and you will learn a lot as I did when I started it.

1 Like

Thanks for the reply. I am trying to set up a server using Docker and am still very far from the point. Before trying I would like to see my .war file running on the browser on my local Linux system.
With your documentation and Google I am making great strides but I continue to have some difficulties with IPs.
In the code I find:
-p 8088: 80
After starting the container I have 2 valid IPs:
172.17.0.4:80 (IP container)
172.17.0.1:8088 (gateway)
This gateway, as written in the documentation, is used to put two networks in communication.
Suppose I buy a server with IP 150.150.150.150.
To access the server I type 150.150.150.150 in the browser.
If I connect to the server and want to see the contents of the container I have to use the gateway, right?
In practice when I configure the server I have to make sure that every call from the client to 150.150.150.150 the server provides the gateway 172.17.0.1:8088 which retrieves the resource available at 172.17.0.4:80.
Basically the gateway (172.17.0.1:8088) allows you to connect Docker’s private network (172.17.0.4:80) to the public network my server is connected to (150.150.150.150), right?
So the path is this:
client private ip> gateway client> 150.150.150.150> 172.17.0.1:8088> 172.17.0.4:80.
Did I understand this or, in your opinion, am I still making some mistakes?

Docker will use the gateway under the hood when required, there is nothing you have to do or should do with the gateway. Consider it as internal part of dockers container network magic.

Assumed your application realy runs on port 80 inside the container (which is NOT the default port for a spring boot application) and you publish the container port 80 to the host port 8088 using -p 8088:80, then you would use the url http://150.150.150.150:8088 in your browser.

If you try to access a container by ip, it is high likely you are trying to do something that is not supposed to be done like that. Host to container access is done using the host ip and the published host port. Container to container access is done using the service name and container port of the target container - though this will not work if the containers are attached to the default bridge network, it only works for user defined networks)…

1 Like

So how do I find the right IP that I should use with port 8088 on my virtual version of Ubuntu installed on VMware?

If your vm uses a bridged nic: check ip a to see the current ips.
If your vm uses a natted nic: add the portforwarding from windows to your vm and than access it using localhost?

The only part unrelated to vmware in this response is ip a.

1 Like

I didn’t bother with this when I installed Linux on VMware. My goal is to see my .war running in Linux. I didn’t bother with anything else as my ultimate goal is to create the dynamic website with Docker on a real server. Which path do you recommend me to take? Which approach do you use? I accept advice very gladly.

gi@Ubuntu-22:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:0e:13:9e brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet 192.168.17.130/24 brd 192.168.17.255 scope global dynamic noprefixroute ens33
       valid_lft 1678sec preferred_lft 1678sec
    inet6 fe80::c84e:b5e9:4166:73da/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:1d:22:25:3e brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:1dff:fe22:253e/64 scope link 
       valid_lft forever preferred_lft forever
5: veth57fa555@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether fa:9d:ab:60:c2:89 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::f89d:abff:fe60:c289/64 scope link 
       valid_lft forever preferred_lft forever
gi@Ubuntu-22:~$

ipconfig

Configurazione IP di Windows


Scheda Ethernet Ethernet:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:

Scheda Ethernet VirtualBox Host-Only Network #2:

   Suffisso DNS specifico per connessione:
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::714d:4ea3:b04d:ce71%15
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.99.1
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Gateway predefinito . . . . . . . . . :

Scheda Ethernet VirtualBox Host-Only Network:

   Suffisso DNS specifico per connessione:
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::85f9:4396:c0a:a525%13
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.56.1
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Gateway predefinito . . . . . . . . . :

Scheda LAN wireless Connessione alla rete locale (LAN)* 1:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:

Scheda LAN wireless Connessione alla rete locale (LAN)* 14:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:

Scheda Ethernet VMware Network Adapter VMnet1:

   Suffisso DNS specifico per connessione:
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::8112:1851:88f2:3ac4%12
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.13.1
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Gateway predefinito . . . . . . . . . :

Scheda Ethernet VMware Network Adapter VMnet8:

   Suffisso DNS specifico per connessione:
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::4464:9fbf:2ab8:bbe8%2
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.17.1
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Gateway predefinito . . . . . . . . . :

Scheda LAN wireless Wi-Fi:

   Suffisso DNS specifico per connessione:
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::9d3a:2c19:558c:9b66%25
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.43.55
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Gateway predefinito . . . . . . . . . : 192.168.43.1

I don’t use BRIDGED and I think I don’t need a new network node because I only have one PC and I only ever work on one computer.
I don’t use HOST-ONLY because otherwise I can’t connect to the internet and download the Docker repository.
I use NAT but have not configured VMware, Windows and Linux.
I have read the meaning of the word ‘port forwarding’ and I believe the answer to your question is no, in fact Ubuntu and Windows are not communicating. To move files from Windows to Ubuntu and vice versa I use Dropbox (with NAT Ubuntu can surf the internet) because VMware’s ‘shared folders’ function doesn’t work.
When the VM is open localhost does not work on Ubuntu nor on Windows. These addresses don’t work on Windows or Ubuntu either:

https://localhost:8088/
https://localhost/

Regarding ‘port forwarding’ I read that many things can be done.
For example, you can run an FTP server as VM and provide that FTP service for the local users. You can even go a step further and run a web server on the VMware workstation pro and make it available for internet users as well.
I don’t want to do any of that. I just want to test my configuration on Ubuntu, forget about Windows and then replicate this configuration on the real server that I will buy.

Why have you forsaken me?
Can you explain what I have to do to manage my containers?
I would like, besides knowing the exact IP, to use ‘localhost’ because in the .war files that I use locally and that I build with the IDE I use ‘localhost’.

We don’t always have time and hard to keep track of topics sometimes. Especially when it is so general so thanks for the reminder.

However, you started this topic with the title “Get the old Docker images and containers back into operation” and continued to ask all of your new questions here. It was hard for me to follow the topic and I can’t even say that I always understood the question. We don’t even talk about Windows anymore, even though this topic is in the “Docker Desktop for Windows” category.

Please, think through your problem and split it into smaller questions in separate topics. If you need, you can ask for general advice so you understand what you need to do. Then solve it step by step so every one of your questions are clear and small enough to answer it.

If you ask everything here, nobody will understand what we are talking about and why, so you will have only me and Metin at best.

If you search for “docker localhost”, you will probably find the answer. I could have misunderstood this question too, so you should really make it easier for us to help you. In other words: help us to help you.

I have been composing my answer for about 40 minutes… because I really wanted to understand your current problem, but I gave up so I ask you to consider what I suggested above. Focus on one problem in a topic.

It is possible that @meyay understand your issue and I am the only one confused here, so he might answer what I could not, but I suppose it would be better even for him to continue it in separate topics.

1 Like