Skip to content

Instantly share code, notes, and snippets.

@yebt
Last active July 9, 2022 13:28
Show Gist options
  • Save yebt/d4c9f6b644b773d0974358ce5eb38e65 to your computer and use it in GitHub Desktop.
Save yebt/d4c9f6b644b773d0974358ce5eb38e65 to your computer and use it in GitHub Desktop.

Try use the nginx proxy with podman

Dependincies

  • podman
  • podman-remote
  • podman-docker
  • podman-gvproxy
  • podman-docker
  • podman-compose

Manually run podman service

podman system service -t 0 --log-level=debug

Knonw podman.sock file

Later than you run the podoman service use grep and the podman-remote to get the file:

podman-remote info | grep sock

In my case the return show : path: unix:///run/user/1000/podman/podman.sock, then use this /run/user/1000/podman/podman.sock inside the container-composer.yml

Basic foold struct

wrk_dir
├─ src/
│  └─.. project content ..
└─ nginx/
   └─ proxy/
      ├─ error.log #init empty file
      └─ access.log #init empty file

Set the host

in the file /etc/hosts put the vhots, in this case i put:

#...
127.0.0.1  shopp.test
127.0.0.1  spdr.local

container-composer

version: '2'
services:

  nginx-proxy:
    image: nginxproxy/nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /run/user/1000/podman/podman.sock:/tmp/docker.sock:Z
      - ./nginx/error.log:/var/log/nginx/error.log:Z
      - ./nginx/access.log:/var/log/nginx/access.log:Z
      # - /var/run/docker.sock:/tmp/docker.sock:ro
    privileged: true
    container_name: nginx-proxy
    restart: always
    # hostname: nginx-proxy

  w1:
    image: nginx
    # hostname: shopp.test
    # dns_search: shopp.test
    environment:
      - VIRTUAL_HOST=shopp.test
      - VIRTUAL_PORT=80
      # - NGINX_HOST=shopp.test
      # - NGINX_PORT=80
    expose:
      - "80"
    volumes:
      - ./src:/usr/share/nginx/html:z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment