我是使用Podman的新手,并且正在尝试与Richard Walker的教程一起对django应用(https://www.richardwalker.dev/django-podman.html)进行容器化
在我尝试停止并重新启动Pod之前,它工作正常。然后,我的主机无法再连接到端口(在构建映像时暴露,在创建Pod时映射)。 文档和指南建议它很简单
podman pod stop ...
podman pod start ...
但这似乎不起作用。
如果您能看到我遗漏了一些东西,将非常感谢您的帮助。
$ podman pod create -p 8000 -p 7000 -p 5432 -n cardpod
8553ad8fc0b14a849598a51c4ffcbffa9d6d094b96b542f0e432fc0d6dfd22ff
$ podman run --name deckofcards-prod-ctr --pod cardpod -d richardwalker.dev/deckofcards-prod-img
3dbf6f9ad043fe65492f0e15be642af92916ad9e09d941e1f96315343a8d2fae
$ curl http://127.0.0.1:7000/deck/
[{"suit":"clubs","face":"queen","value":10},{"suit":"spades","face":"four","value":4},{"suit":"hearts","face":"king","value":10},{"suit":"diamonds","face":"six","value":6},{"suit":"hearts","face":"two","value":2},{"suit":"diamonds","face":"ace","value":1},{"suit":"hearts","face":"eight","value":8},{"suit":"clubs","face":"three","value":3},{"suit":"spades","face":"five","value":5},{"suit":"clubs","face":"nine","value":9},{"suit":"spades","face":"nine","value":9},{"suit":"diamonds","face":"five","value":5},{"suit":"hearts","face":"nine","value":9},{"suit":"diamonds","face":"two","value":2},{"suit":"clubs","face":"king","value":10},{"suit":"diamonds","face":"eight","value":8},{"suit":"clubs","face":"ace","value":1},{"suit":"hearts","face":"three","value":3},{"suit":"spades","face":"jack","value":10},{"suit":"hearts","face":"ten","value":10},{"suit":"spades","face":"king","value":10},{"suit":"spades","face":"ace","value":1},{"suit":"spades","face":"ten","value":10},{"suit":"hearts","face":"five","value":5},{"suit":"hearts","face":"ace","value":1},{"suit":"clubs","face":"eight","value":8},{"suit":"hearts","face":"jack","value":10},{"suit":"diamonds","face":"queen","value":10},{"suit":"clubs","face":"ten","value":10},{"suit":"diamonds","face":"nine","value":9},{"suit":"clubs","face":"five","value":5},{"suit":"clubs","face":"jack","value":10},{"suit":"diamonds","face":"ten","value":10},{"suit":"hearts","face":"queen","value":10},{"suit":"diamonds","face":"seven","value":7},{"suit":"hearts","face":"seven","value":7},{"suit":"hearts","face":"six","value":6},{"suit":"spades","face":"two","value":2},{"suit":"clubs","face":"two","value":2},{"suit":"clubs","face":"seven","value":7},{"suit":"spades","face":"seven","value":7},{"suit":"clubs","face":"four","value":4},{"suit":"spades","face":"queen","value":10},{"suit":"diamonds","face":"king","value":10},{"suit":"spades","face":"six","value":6},{"suit":"diamonds","face":"jack","value":10},{"suit":"diamonds","face":"four","value":4},{"suit":"hearts","face":"four","value":4},{"suit":"clubs","face":"six","value":6},{"suit":"diamonds","face":"three","value":3},{"suit":"spades","face":"three","value":3},{"suit":"spades","face":"eight","value":8}]
$ podman pod stop cardpod
8553ad8fc0b14a849598a51c4ffcbffa9d6d094b96b542f0e432fc0d6dfd22ff
$ podman pod start cardpod
8553ad8fc0b14a849598a51c4ffcbffa9d6d094b96b542f0e432fc0d6dfd22ff
$ curl http://127.0.0.1:7000/deck/
curl: (7) Failed to connect to 127.0.0.1 port 7000: Connection refused
更多信息:
通过检查“ podman日志
根据教程的dockerfile:
# FROM directive instructing base image to build upon
FROM python:3.7-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Create and change to working dir
RUN mkdir /code
WORKDIR /code
# Copy code
COPY /release/ /code/
# Install dependencies
COPY requirements.txt /code/
RUN pip install -r requirements.txt
# EXPOSE port 7000 to allow communication to/from server
EXPOSE 7000
# CMD specifies the command to execute to start the server running.
CMD python3 manage.py runserver 0.0.0.0:7000
podman:版本2.0.2
发行版:ubuntu 18.04