Redis with wsl2 podman - connection refused - redis

I'm running Ubuntu 20.04 within WSL2 on Windows 10.
I installed podman.
>podman -v
podman version 3.
I tried starting a container with
podman run --name some-redis -d -p 6379:6379 redis
The container is starting. No errors in the log.
If I tried
redis-cli
From Ubuntu it's working.
From dos/powershell it is not working
rdcli -h localhost
localhost:6379> (error) Redis connection to localhost:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
And also it is not working with my SpringBoot application.
I'm also using a portainer container with port mapping 9000:9000 and I can access it from ubuntu, dos, powershell.
So what's the problem with redis. Is it coming from redis or from wsl2/podman ?
What can I do.
ps : The same container on the same machine with docker desktop was working fine.

You probably run into this WSL2 issue: https://github.com/microsoft/WSL/issues/4851
Solution:
option 1: use [::1]:6379 instead of localhost:6379 from Windows side
option 2: use -p 127.0.0.1:6379:6379 instead of -p 6379:6379 with podman run.

Related

Cannot use pintos by ssh

I use a docker container to try pintos on my mac(M1). Everything behaves well when I start the container by docker start -i pintos.
However, when I use ssh to connect my docker container(i.e., ssh -p xxxx root#local), error message -bash: pintos: command not found occurs if I try pintos -- in directory /pintos/src/threads/build.

I need to run standalone-chrome-debug in offline mode

I have a linux server, with no connectivity to github (it's blocked in our office), and need to run standalone-chrome-debug docker image.
So in my side, i clone the repo and transfer it to the linux machine, but when i run the docker command:
docker run -d -p 4444:4444 -p 0:5900 -v /dev/shm:/dev/shm -e VNC_NO_PASSWORD=1 selenium/standalone-chrome-debug
i got a lot of error, such as entry_point.sh not found, and different similar issues of missing files, so my question is:
how can i make this docker run successfully , if i have the repository locally, and have no access to github, can you assist me with this issue ?

How are the --network options available in podman?

I am running a virtual environment on CentOS with podman.
When I used the --net option of the podman run command, I get an error.
[user#server ~]$ podman run --net slirp4netns:port_handler=slirp4netns -p 1080:80 -d --name web nginx
Error: cannot join CNI networks if running rootless: invalid argument
Is this option unavailable?
Or is there a problem with the way the options are specified?
Please tell me solution.
I used this site as a reference for the command.
This is the configuration of the server.
[user#server ~]$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
[user#server ~]$ podman -v
podman version 2.0.6
The port_handler option requires Podman >= 2.1.0, which isn't released at this moment: https://github.com/containers/podman/commit/d86bae2a01cb855d5964a2a3fbdd41afe68d62c8
You can use that option if you compile Podman from its master branch.
I find this link quite helpful to see rootless communication :
https://www.redhat.com/sysadmin/container-networking-podman
https://podman.io/getting-started/network
I am not sure if you have seen this link before or even if it is helpful to you at this instance. But, in view of helping others out, I think the blog post quotes the following helpful statements:
Note: All podman network commands are for rootfull containers only.
Technically, the container itself does not have an IP address, because without root privileges, network device association cannot be achieved
When using Podman as a rootless user, the network is setup automatically. The container itself does not have an IP Address, because without root privileges, network association is not allowed. You will also see some other limitations.

docker container error "Failed to get D-Bus connection: Operation not permitted"

getting error"Failed to get D-Bus connection: Operation not permitted" while using systemctl command for restarting service in centos container.
use below command to start the docker container.
docker run -d -it --privileged ContainerId /usr/sbin/init
use docker file from below link for fix this issue. when run the docker image use --privileged.
https://hub.docker.com/_/centos
add these lines to docker file

Redis server fails to start in docker

I have a docker image 'redis_image' that installed redis in it. After I run a container as:
docker run --name test_redis -it redis_image bash
the redis server can start normally in the container using '/etc/init.d/redis start'.
But if I run the container with --net=host option, the redis server will fail to start in the container, it says "Starting redis-server: could not open session [Failed]". Is the problem related to the --net=host configuration when I run the container? Thanks.