0

I am new to podman, trying to create pod with two container mysql and wordpress. Below are podman cli command.

podman run --name mysql --pod new:mysqlpod -e MYSQL_ROOT_PASSWORD=sdk123 -d docker.io/library/mysql

podman run --name wordpress -p 8080:80 --pod mysqlpod -e WORDPRESS_DB_HOST=mysql:3306 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=sdk123 -e WORDPRESS_DB_NAME=mywordpress -e WORDPRESS_TABLE_PREFIX=wp_ -d docker.io/library/wordpress

I am testing above pod in http://lab.redhat.com/podman-deploy.

When i try to create wordpress container, i get below error

cannot set port bindings on an existing container network namespace

SudhirKumar
  • 366
  • 2
  • 4
  • 16

1 Answers1

1

The first command creates a new pod and a container. The second one will join the pod and the existing network namespace.

You could invert the two commands, since the second one needs the ports bindings:

podman run --name wordpress -p 8080:80 --pod new:mysqlpod -e WORDPRESS_DB_HOST=mysql:3306 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=sdk123 -e WORDPRESS_DB_NAME=mywordpress -e WORDPRESS_TABLE_PREFIX=wp_ -d docker.io/library/wordpress


podman run --name mysql --pod mysqlpod -e MYSQL_ROOT_PASSWORD=sdk123 -d docker.io/library/mysql

Giuseppe Scrivano
  • 1,385
  • 10
  • 13
  • i could see pod has been created but giving me an error with Error "establishing a database connection". I also would like to know what makes difference mysql pod created first and wordpress joined it. – SudhirKumar May 12 '20 at 19:45