Sorry, I noticed a malfunction.
After a few days if I go to see my volumes, I see that they are many and above all they don’t have the name I chose.
To delete them I have to use this code:
docker volume prune -f
This code does not work:
docker volume rm pg_data
Why does this happen, where am I wrong?
I want to use this code:
docker volume rm pg_data

docker volume ls
DRIVER VOLUME NAME
local 374717f09e118c9fcf54c79dd3b1e32dff96c96d3036294c3c7074ac83d65617
local 4beb3de74d406f3f0a9e21b00169ee3815a342c08932df3f9003ee4f831ac3a1
local 4dd868488ec5392a4a7af7bc2b84d6208e8f1479edc136c7da05115678573dc7
…
local 6bc90baa935ddd5236a6519f7e792b7501f7882b212a10cd46fc73783b960a2a
local dockertomcatposgresql_pg_data
Dockerfile:
VOLUME create pg_data
docker-compose.yaml:
- pg_data:/var/lib/postgresql
NOTE: This string is missing the “-”:
dockertomcatposgresql_pg_data
Can the “-” be used?
Ubuntu 18.04:
docker volume inspect pg_data
[]
Error: No such volume: pg_data
docker network ls
NETWORK ID NAME DRIVER SCOPE
c02582c6b967 03dockertomcatposgresql_eb bridge local
ee5adcaeb8c6 bridge bridge local
4288207bc650 host host local
09b5e51dc601 none null local
Windows 10:
docker volume inspect pg_data
[]
Error: No such volume: pg_data
docker network ls
NETWORK ID NAME DRIVER SCOPE
5dff3ac1fa00 bridge bridge local
360d1e5b22cf dockertomcatposgresql_eb bridge local
76aabefdadf9 host host local
6898337a5757 none null local
I found another problem. If I run this file on Ubuntu my application can’t connect. On Windows I don’t have problems. Using JDBC with Ubuntu I use these credentials:
{
"url": "jdbc:postgresql://localhost:5432/gis",
"user": "eb",
"password": "password"
}
On Windows I use these other credentials:
{
"url": "jdbc:postgresql://192.168.99.103:5432/gis",
"user": "eb",
"password": "password"
}
prompt-windows.txt (3.8 KB)
docker-compose.txt (725 Bytes)
I have investigated the problem and I think it is a network problem but finding the solution is impossible for me.
My webapp crashes here:
conn = DriverManager.getConnection(url, user, password);
The parameters supplied to “DriverManager.getConnection()” are correct. I get “500 Internal Server Error” on Ubuntu while on Windows no.
url = "jdbc:postgresql://localhost:5432/gis";
user = "eb";
password = "password";
I also tried disabling the firewall on Ubuntu but I didn’t fix it. This is my DockerCompose installation:
sudo apt-get clean
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
lsb_release -cs
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
bionic \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
sudo groupadd docker
sudo usermod -aG docker gi
sudo reboot
newgrp docker
docker run hello-world
sudo systemctl enable docker
sudo snap install docker
sudo apt install docker-compose
docker-compose.yaml
version: '3.3'
services:
tomcat_eb:
build: ./tomcat
image: image-tomcat-eb:v.1.0
container_name: container-tomcat-eb
ports:
- 8888:8080
restart: on-failure
depends_on:
- postgresql
networks:
- eb
postgresql:
build: ./postgresql-postgis
image: image-postgresql-postgis-eb:v.1.0
container_name: container-postgresql-postgis-eb
ports:
- 5432:5432
volumes:
- pg_data:/var/lib/postgresql
environment:
POSTGRES_USER: "eb"
POSTGRES_PASS: "password"
POSTGRES_DBNAME: "gis"
ALLOW_IP_RANGE: "0.0.0.0/0"
restart: always
networks:
- eb
volumes:
pg_data:
networks:
eb:
Tomcat Dockerfile:
FROM tomcat:9.0.22-jdk13-openjdk-oracle
LABEL Author="Nome Cognome"
EXPOSE 8080
COPY ./*.war /usr/local/tomcat/webapps/
CMD ["catalina.sh", "run"]
DBMS Dockerfile:
FROM kartoza/postgis:9.6-2.4
LABEL Author="Nome Cognome"
EXPOSE 5432
VOLUME create pg_data
Another thing I don’t understand is because I can’t use version 3.7, the one I think you’re using.