Error message when creating a postgresql container using Podman [closed] - postgresql

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 13 days ago.
Improve this question
I am unable to create a postgress container using Podman in Ubuntu from why Windows terminal and I don't know why.
this is my command :
podman pod create --name postgress-container -p 8080:8080
this is the message I get:
"Error: repository name must have at least one component"

You are probably missing the image name postgres:<version>
Also podman pod is not the right command to create a container. Pods provide Infrastructure for containers. Read more here: https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods
In your case i would run something like this:
podman create -it --name postgress-container -p 8080:8080 postgres:15.1
but if you start this container it won't run, because you need to set initial postgres password, like so:
podman create -it --name postgress-container -e POSTGRES_PASSWORD=mysecretpassword -p 8080:8080 postgres:15.1
or better formatted:
podman create -it --name postgress-container \
-e POSTGRES_PASSWORD=mysecretpassword \
-p 8080:8080 \
postgres:15.1
See also docs from postgesql on dockerhub: https://hub.docker.com/_/postgres/
Most docker commands can be made to docker commands by replacing docker with podman.

Related

Spun up a Postgres Docker container without exposing ports. How can I expose without losing data? [duplicate]

This question already has answers here:
How do I assign a port mapping to an existing Docker container?
(15 answers)
Closed 7 months ago.
To preface, I'm not a Docker novice (or expert), just unsure how to complete this without blowing up my current container.
I'm playing around with Postgres and spun up a container using this command without realizing it won't expose Postgres outside of Docker
docker run --name postgres -e POSTGRES_PASSWORD=<password> -d postgres
I want to be able to have this data accessible to other systems. I do not want to remove the container since I have quite a bit of configuration already done.
I've tried editing the container hostconfig.json file in /var/lib/docker/containers after stopping the instance, but the file gets overwritten after starting the container back up.
What's the best practice to expose a port outside of the container?
Any change in within the container will be reset to initial state if you restart the container
so any data you need to persist must be added to a docker volume
so you need first to persist data
then expose ports
To do this you may run
$ docker run -d \
--name some-postgres \
-p 5432:5432 \
-e POSTGRES_PASSWORD=mysecretpassword \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ./postgresql:/var/lib/postgresql/data \
postgres
more details here
https://hub.docker.com/_/postgres

How to install chrony on redhat 8 minimal

Im using keycloak docker image and need to synchronize time with chrony. however I cannot install chrony, because its not in repository i assume.
I use image from https://hub.docker.com/r/jboss/keycloak
ist based on registry.access.redhat.com/ubi8-minimal
Steps to reproduce:
~$ docker run -d --rm -p 8080:8080 --name keycloak jboss/keycloak
~$ docker exec -it -u root keycloak bash
root#707c136d9c8a /]# microdnf install chrony
error: No package matches 'chrony'
I'm not able to find working repo which provides chrony for redhat 8 minimal
Apparently i need synchronize time on host system, nothing to do with container itself.. Silly me, i need a break..

Docker Postgres Image not accessible

So, I pulled the postgres image down from docker. I followed a tutorial which explained what's going with the command below and the the whole docker pull. I can log in to the instance fine. But when I restart my computer or shutdown docker I end up goign through similar setup steps and am not able to access the postgres instance anymore. Can someone explain what's going on here:
Run this command
docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d postgres -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
log in via PG admin.
Nothing, instance not available.
So, I feel like I am missing a step at one point I had executed a command like this:
docker exec -it c5b8bdd0820b35a01ea153a44e82458a6285cf484b701b2b2d6d4210266fb4f8 bash
which gave me acess to the shell for the image, after doing that I was able then to use PGAdmin, however, I feel like that may have been coincidence? As this does not work currently.
So, what am I doing wrong? What's an easier way to do this?
The --rm causes Docker to automatically remove the container when it exits. Remove it.
You can also add --restart always and your container will be up after restart.

PostgreSQL docker container not writing data to disk

I am having some difficulty with docker and the postgres image from the Docker Hub. I am developing an app and using the postgres docker to store my development data. I am using the following command to start my container:
sudo docker run --name some-postgresql -e POSTGRES_DB=AppDB -e POSTGRES_PASSWORD=App123! -e POSTGRES_USER=appuser -e PGDATA="/pgdata" --mount source=mydata,target=/home/myuser/pgdata -p 5432:5432/tcp postgres
When I finish working on my app, I usually have to run "docker container prune", in order to free up the container name and be able to run it again later. This worked until recently, when I upgraded my postgres image to run version 11 of PostgreSQL. Now, when I start my container and create data in it, the next time I use it the data is gone. I've been reading about volumes in the docker documentation cannot find anything that can tell my why this is not working. Can anyone please shed some light on this?
Specify a volume mount with -v $PGDATA_HOST:/var/lib/postgresql/data.
The default PGDATA inside the container is /var/lib/postgresql/data so there is no need to change that if you're not modifying the Docker image.
e.g. to mount the data directory on the host at /srv/pgdata/:
$ PGDATA_HOST=/srv/pgdata/
$ docker run -d -p 5432:5432 --name=some-postgres \
-e POSTGRES_PASSWORD=secret \
-v $PGDATA_HOST:/var/lib/postgresql/data \
postgres
The \ are only needed if you break the command over multiple lines, which I did here for the sake of clarity.
since you specified -e PGDATA="/pgdata", the database data will be written to /pgdata within the container. If you want the files in /pgdata to survive container deletion, that location must be a docker volume. To make that location a docker volume, use --mount source=mydata,target=/pgdata.
In the end, it would be simpler to just run:
sudo docker run --name some-postgresql -e POSTGRES_DB=AppDB -e POSTGRES_PASSWORD=App123! -e POSTGRES_USER=appuser --mount source=mydata,target=/var/lib/postgresql/data -p 5432:5432/tcp postgres

Restcomm Docker Installation Issues

I'm trying to getting started with restcomm following this guide:
http://docs.telestax.com/restcomm-docker-quick-start-guide/
but I'm facing two issues at this time:
Cannot make SIP calls. After I run the docker run command my softphone (X-Lite) can register successfully with the server but when I try to call +1234 I receive 'Call failed to connect'. This is what I see in logs:
https://justpaste.it/tdjg
I also can't connect to Visual Service Designer. This is what I see:
Log:
https://justpaste.it/tdjm
The docker command that I'm using is:
docker run --rm -i -t --name=restcomm-instance -v /var/log/restcomm/:/var/log/restcomm/ -e STATIC_ADDRESS="192.168.1.150" -e ENVCONFURL="https://raw.githubusercontent.com/RestComm/Restcomm-Docker/master/scripts/restcomm_env_locally.sh" -e VOICERSS_KEY="fdf04434829e4e02addd8d54b69e6bc0" -p 80:80 -p 443:443 -p 9990:9990 -p 5060:5060 -p 5061:5061 -p 5062:5062 -p 5063:5063 -p 5060:5060/udp -p 65000-65050:65000-65050/udp restcomm/restcomm:latest
And the servo is:
Hope you can help me.
Regards
The Restcomm Docker Quick start guide has recently been updated and should now be much more straightforward to deploy Restcomm on Docker, using Docker compose.