小编Ray*_*der的帖子

如何在ubuntu docker容器中自动启动apache2?

我正在尝试创建一个自动启动Apache的Dockerfile.没有任何效果.但是,如果我登录容器并运行service apache2 start它的工作原理.为什么我不能从我的Dockerfile运行该命令?

FROM ubuntu

# File Author / Maintainer
MAINTAINER rmuktader

# Update the repository sources list
RUN apt-get update

# Install and run apache
RUN apt-get install -y apache2 && apt-get clean

#ENTRYPOINT ["/usr/sbin/apache2", "-k", "start"]


#ENV APACHE_RUN_USER www-data
#ENV APACHE_RUN_GROUP www-data
#ENV APACHE_LOG_DIR /var/log/apache2

EXPOSE 80
CMD service apache2 start
Run Code Online (Sandbox Code Playgroud)

apache ubuntu docker dockerfile

23
推荐指数
3
解决办法
3万
查看次数

如何解决错误:未使用推荐的安装程序安装 Poetry。无法自动更新

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -几个月前,我在 mac 上使用安装了诗歌:

当我运行时,poetry self update -v我看到以下错误:

[RuntimeError]
Poetry was not installed with the recommended installer. Cannot update automatically.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/poetry/console/commands/self/update.py", line 64, in handle
    raise RuntimeError(
Run Code Online (Sandbox Code Playgroud)

自安装以来,此错误一直存在。我一直没有找到解决办法。如果有帮助,我安装了 …

python python-poetry

6
推荐指数
1
解决办法
448
查看次数

如何从主机连接到 Docker Postgres 容器

我按照https://docs.docker.com/compose/rails/ 中的说明整理了一个 Rails 开发环境

它有效,但我无法从主机连接到 Postgres 服务器。我正在运行 macOS High Sierra。当我运行时,docker container ls我看到5432/tcp的是 Postgres 容器的端口。请注意,在docker network inspect <postgress_container_ID>5432前面没有列出IP。当我运行时,我得到 172.18.0.2 作为 IP。

但是当我跑步时psql -h 172.18.0.2 -p 5432 -U postgres我得到

xpsql: could not connect to server: Operation timed out
  Is the server running on host "172.18.0.2" and accepting
  TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

postgresql remote-connection rails-postgresql docker

5
推荐指数
1
解决办法
2万
查看次数


如何在 Django 中模拟函数?

我希望无论传入什么内容,以下调用which_user都会返回,但它的行为就好像它根本没有被嘲笑一样。self.user

def test_user_can_retrieve_favs_using_impersonation(self):
        with mock.patch('impersonate.helpers.which_user', return_value=self.user):
            user = which_user(self.user2)
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么?我which_user像这样导入:from impersonate.helpers import which_user如果有帮助的话。

python django django-testing python-unittest python-unittest.mock

3
推荐指数
1
解决办法
2429
查看次数