简体   繁体   English

我无法在 Windows 7 上启动我的 Docker 容器

[英]I can't start my Docker container on Windows 7

My PC runs on Windows 7 x64 and it is a part of a domain.我的电脑在 Windows 7 x64 上运行,它是域的一部分。 Frankly speaking I haven't been thinking of moving to Windows 10 Pro in a near future although I didn't realize how close I would be to installing it.坦率地说,我并没有考虑在不久的将来迁移到 Windows 10 Pro,尽管我没有意识到我离安装它有多近。

I've recently begun reading Django for Professionals 3.0: Production Websites with Python & Django by William S. Vincent and the very first hindrance I came across is Dockers.我最近开始阅读 Django for Professionals 3.0: Production Websites with Python & Django by William S. Vincent,第一个障碍是

Docker Desktop can be installed only on Windows 10 I therefore downloaded Docker Toolbox. Docker 桌面只能安装在 Windows 10 因此我下载了 Docker 工具箱。 For no reason the virtual machine didn't want to boot.... I tried to upgrade Oracle VM VirtualBox 5.2.x version to 6.1.10.虚拟机无缘无故不想启动....我尝试将 Oracle VM VirtualBox 5.2.x 版本升级到 6.1.10。 Finally it worked although it always wants to be run as an administrator.最后它工作了,尽管它总是想以管理员身份运行。 I don't know if it matters that some files (.docker) located in /Users/Administrator and the others (like.virtualenv of pipenv) in /Users/notebook.....我不知道 /Users/Administrator 中的某些文件(.docker)和 /Users/notebook 中的其他文件(如 pipenv 的 .virtualenv)是否重要.....

Anyway.... closer to the point.... I'm unable to start my container.无论如何....接近重点....我无法启动我的容器。

Code written in the book 书上写的代码

Here's the process in my terminal:这是我终端中的过程:

    Starting "default"...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to configure a dhcp server. Somet
imes, such confirmation window is minimized in the taskbar.
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-m
achine env` command.
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): Regeneratin
g TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...



                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/

docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com


Start interactive shell

Administrator@notebook-pc MINGW64 /c/Program Files/Docker Toolbox
$ cd C:/python/django_professionals/chapter1/postgresql

Administrator@notebook-pc MINGW64 /c/python/django_professionals/chapter1/postgr
esql
$ docker build .
Sending build context to Docker daemon  168.4kB
Step 1/7 : FROM python:3.8
 ---> 7f5b6ccd03e9
Step 2/7 : ENV PYTHONDONTWRITEBYTECODE 1
 ---> Using cache
 ---> 7b68f08f6658
Step 3/7 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> 6cf532d90680
Step 4/7 : WORKDIR /code
 ---> Using cache
 ---> c870b6c66708
Step 5/7 : COPY Pipfile Pipfile.lock /code/
 ---> 55b431e61e7e
Step 6/7 : RUN pip install pipenv && pipenv install --system
 ---> Running in c5aa07e5ac12
Collecting pipenv
  Downloading pipenv-2020.6.2-py2.py3-none-any.whl (3.9 MB)
Collecting virtualenv-clone>=0.2.5
  Downloading virtualenv_clone-0.5.4-py2.py3-none-any.whl (6.6 kB)
Collecting virtualenv
  Downloading virtualenv-20.0.21-py2.py3-none-any.whl (4.7 MB)
Collecting certifi
  Downloading certifi-2020.4.5.2-py2.py3-none-any.whl (157 kB)
Requirement already satisfied: pip>=18.0 in /usr/local/lib/python3.8/site-packag
es (from pipenv) (20.1.1)
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.8/si
te-packages (from pipenv) (47.1.1)
Collecting distlib<1,>=0.3.0
  Downloading distlib-0.3.0.zip (571 kB)
Collecting six<2,>=1.9.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting filelock<4,>=3.0.0
  Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting appdirs<2,>=1.4.3
  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Building wheels for collected packages: distlib
  Building wheel for distlib (setup.py): started
  Building wheel for distlib (setup.py): finished with status 'done'
  Created wheel for distlib: filename=distlib-0.3.0-py3-none-any.whl size=340427
 sha256=ffd8dd029b231bab7f36c48a93deb41ebc003d83bbb76c6782ecb980bb4af9fb
  Stored in directory: /root/.cache/pip/wheels/eb/4e/d2/a903d4184fb49e4ac06474d6
5715b129aee13d69f7d227e78e
Successfully built distlib
Installing collected packages: virtualenv-clone, distlib, six, filelock, appdirs
, virtualenv, certifi, pipenv
Successfully installed appdirs-1.4.4 certifi-2020.4.5.2 distlib-0.3.0 filelock-3
.0.12 pipenv-2020.6.2 six-1.15.0 virtualenv-20.0.21 virtualenv-clone-0.5.4
Installing dependencies from Pipfile.lock (a6086c)
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/code-_Py8Si6I/b
in/python: not found

Output:
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/code-_Py8Si6I/b
in/python: not found

Output:
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/code-_Py8Si6I/b
in/python: not found

Output:
Removing intermediate container c5aa07e5ac12
 ---> cf8a416ce267
Step 7/7 : COPY . /code/
 ---> b427660ce873
Successfully built b427660ce873
SECURITY WARNING: You are building a Docker image from Windows against a non-Win
dows Docker host. All files and directories added to build context will have '-r
wxr-xr-x' permissions. It is recommended to double check and reset permissions f
or sensitive files and directories.

Administrator@notebook-pc MINGW64 /c/python/django_professionals/chapter1/postgr
esql
$ docker-compose up -d
Creating network "postgresql_default" with the default driver
Building web
Step 1/7 : FROM python:3.8
 ---> 7f5b6ccd03e9
Step 2/7 : ENV PYTHONDONTWRITEBYTECODE 1
 ---> Using cache
 ---> 7b68f08f6658
Step 3/7 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> 6cf532d90680
Step 4/7 : WORKDIR /code
 ---> Using cache
 ---> c870b6c66708
Step 5/7 : COPY Pipfile Pipfile.lock /code/
 ---> 5d3f5c973711
Step 6/7 : RUN pip install pipenv && pipenv install --system
 ---> Running in d5ef503bac67
Collecting pipenv
  Downloading pipenv-2020.6.2-py2.py3-none-any.whl (3.9 MB)
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.8/si
te-packages (from pipenv) (47.1.1)
Requirement already satisfied: pip>=18.0 in /usr/local/lib/python3.8/site-packag
es (from pipenv) (20.1.1)
Collecting certifi
  Downloading certifi-2020.4.5.2-py2.py3-none-any.whl (157 kB)
Collecting virtualenv
  Downloading virtualenv-20.0.21-py2.py3-none-any.whl (4.7 MB)
Collecting virtualenv-clone>=0.2.5
  Downloading virtualenv_clone-0.5.4-py2.py3-none-any.whl (6.6 kB)
Collecting appdirs<2,>=1.4.3
  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting six<2,>=1.9.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting filelock<4,>=3.0.0
  Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting distlib<1,>=0.3.0
  Downloading distlib-0.3.0.zip (571 kB)
Building wheels for collected packages: distlib
  Building wheel for distlib (setup.py): started
  Building wheel for distlib (setup.py): finished with status 'done'
  Created wheel for distlib: filename=distlib-0.3.0-py3-none-any.whl size=340427
 sha256=807dad54d4f8b388d70ae61e233267f44c846319e9c8c24f7dbf4496f9dc3ec9
  Stored in directory: /root/.cache/pip/wheels/eb/4e/d2/a903d4184fb49e4ac06474d6
5715b129aee13d69f7d227e78e
Successfully built distlib
Installing collected packages: certifi, appdirs, six, filelock, distlib, virtual
env, virtualenv-clone, pipenv
Successfully installed appdirs-1.4.4 certifi-2020.4.5.2 distlib-0.3.0 filelock-3
.0.12 pipenv-2020.6.2 six-1.15.0 virtualenv-20.0.21 virtualenv-clone-0.5.4
Installing dependencies from Pipfile.lock (a6086c):
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/code-_Py8Si6I/b
in/python: not found

Output:
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/code-_Py8Si6I/b
in/python: not found

Output:
Failed to load paths: /bin/sh: 1: /root/.local/share/virtualenvs/code-_Py8Si6I/b
in/python: not found

Output:
Removing intermediate container d5ef503bac67
 ---> 7d49adf605d1
Step 7/7 : COPY . /code/
 ---> 125b1ac1973c

Successfully built 125b1ac1973c
Successfully tagged postgresql_web:latest
WARNING: Image for service web was built because it did not already exist. To re
build this image you must use `docker-compose build` or `docker-compose up --bui
ld`.
Creating postgresql_web_1 ... done

Administrator@notebook-pc MINGW64 /c/python/django_professionals/chapter1/postgr
esql
$

The only way I was able to run the server is omitting volumes parameter in docker-compose.yml Despite the fact that I get the same error relating to manage.py the actual websever runs anyway.我能够运行服务器的唯一方法是在docker-compose.yml中省略volumes参数尽管我得到了与manage.py相关的相同错误,但实际的websever仍然运行。 The second question is that I only reach the webserver by IP address of a virtual adapter (like 192.168.99.100).第二个问题是我只能通过虚拟适配器的 IP 地址(如 192.168.99.100)到达网络服务器。 127.0.0.1 as described in the book doesn't work.书中描述的 127.0.0.1 不起作用。

Should I move to Windows 10 to deal with the problem or.... Should I carry on reading the book implementing code in local machine?我应该转到 Windows 10 来解决这个问题还是.... 我应该继续阅读在本地机器上实现代码的书吗?

Appreciate any help!感谢任何帮助!

Half of the puzzle I solved at night.我在晚上解决了一半的难题。 When it was building an image I found a line: Downloading pipenv-2020.6.2-py2.py3-none-any.whl It'd installed the latest version of pipenv.在构建图像时,我发现了一行: Downloading pipenv-2020.6.2-py2.py3-none-any.whl它安装了最新版本的 pipenv。 I then decided to force it to install an earlier version.然后我决定强制它安装早期版本。 I don't know if it was correct to write though it worked.我不知道它是否正确写虽然它有效。 I added pipenv==2018.11.26 in Dockerfile我在 Dockerfile 中添加了pipenv== 2018.11.26

# Install dependencies
COPY Pipfile Pipfile.lock /code/
RUN pip install pipenv==2018.11.26 && pipenv install --system

I've skipped chapter 2 and did it locally, however here is the process of chapter 3:我跳过了第 2 章并在本地完成,但是这里是第 3 章的过程:

Step 1/7 : FROM python:3.8
3.8: Pulling from library/python
e9afc4f90ab0: Pulling fs layer
989e6b19a265: Downloading [>                                                  ]
e9afc4f90ab0: Downloading [>                                                  ]
 510.4kB/50.39MBwnloading [>                                                  ]
 101.6kB/9.996MBiting
e9afc4f90ab0: Downloading [=>                                                 ]
e9afc4f90ab0: Downloading [=>                                                 ]
  1.53MB/50.39MBiting
989e6b19a265: Downloading [=====>                                             ]
   920kB/7.812MB
af14b6c2f878: Downloading [====>                                              ]
e9afc4f90ab0: Downloading [==>                                                ]
 2.554MB/50.39MB

e9afc4f90ab0: Downloading [===>                                               ]
 3.066MB/50.39MB

989e6b19a265: Downloading [=============>                                     ]
 2.096MB/7.812MB
e9afc4f90ab0: Downloading [====>                                              ]
 4.086MB/50.39MB

e9afc4f90ab0: Downloading [====>                                              ]
 4.606MB/50.39MB
e9afc4f90ab0: Extracting [===========================================>       ]
e9afc4f90ab0: Extracting [=================================================> ]
50.33MB/50.39MBxtracting [=============================================>     ]
989e6b19a265: Extracting [==========================================>        ]
af14b6c2f878: Extracting [=================================================> ]
 9.83MB/9.996MBxtracting [======================>                            ]
5573c4b30949: Extracting [================================================>  ]
50.33MB/51.83MBxtracting [==============================================>    ]
11a88e764313: Extracting [=================================================> ]
11a88e764313: Extracting [=================================================> ]
ee776f0e36af: Extracting [==================================================>]
ee776f0e36af: Pull complete
513c90a1afc3: Pull complete
df9b9e95bdb9: Extracting [==================================================>]
df9b9e95bdb9: Extracting [==================================================>]
df9b9e95bdb9: Pull complete
86c9edb54464: Pull complete
Digest: sha256:dd6cd8191ccbced2a6af5d0ddb51e6057c1444df14e14bcfd5c7b3ef78738050
Status: Downloaded newer image for python:3.8
 ---> 7f5b6ccd03e9
Step 2/7 : ENV PYTHONDONTWRITEBYTECODE 1
 ---> Running in b28d763d8b67
Removing intermediate container b28d763d8b67
 ---> 4966da35178b
Step 3/7 : ENV PYTHONUNBUFFERED 1
 ---> Running in ab4af6ebaa3f
Removing intermediate container ab4af6ebaa3f
 ---> ca1655c0ba53
Step 4/7 : WORKDIR /code
 ---> Running in be12616879bd
Removing intermediate container be12616879bd
 ---> 238ca146b9f9
Step 5/7 : COPY Pipfile Pipfile.lock /code/
 ---> 90c096a097cf
Step 6/7 : RUN pip install pipenv==2018.11.26 && pipenv install --system
 ---> Running in 3b2aa2611d33
Collecting pipenv==2018.11.26
  Downloading pipenv-2018.11.26-py3-none-any.whl (5.2 MB)
Requirement already satisfied: setuptools>=36.2.1 in /usr/local/lib/python3.8/si
te-packages (from pipenv==2018.11.26) (47.1.1)
Requirement already satisfied: pip>=9.0.1 in /usr/local/lib/python3.8/site-packa
ges (from pipenv==2018.11.26) (20.1.1)
Collecting virtualenv
  Downloading virtualenv-20.0.23-py2.py3-none-any.whl (4.7 MB)
Collecting certifi
  Downloading certifi-2020.4.5.2-py2.py3-none-any.whl (157 kB)
Collecting virtualenv-clone>=0.2.5
  Downloading virtualenv_clone-0.5.4-py2.py3-none-any.whl (6.6 kB)
Collecting filelock<4,>=3.0.0
  Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting six<2,>=1.9.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting appdirs<2,>=1.4.3
  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting distlib<1,>=0.3.0
  Downloading distlib-0.3.0.zip (571 kB)
Building wheels for collected packages: distlib
  Building wheel for distlib (setup.py): started
  Building wheel for distlib (setup.py): finished with status 'done'
  Created wheel for distlib: filename=distlib-0.3.0-py3-none-any.whl size=340427
 sha256=ca936027ba8b3e15b02cb9a79b68426ee67750091e72c1ed2eb67a27380096c6
  Stored in directory: /root/.cache/pip/wheels/eb/4e/d2/a903d4184fb49e4ac06474d6
5715b129aee13d69f7d227e78e
Successfully built distlib
Installing collected packages: filelock, six, appdirs, distlib, virtualenv, cert
ifi, virtualenv-clone, pipenv
Successfully installed appdirs-1.4.4 certifi-2020.4.5.2 distlib-0.3.0 filelock-3
.0.12 pipenv-2018.11.26 six-1.15.0 virtualenv-20.0.23 virtualenv-clone-0.5.4
Installing dependencies from Pipfile.lock (22c09e):
Removing intermediate container 3b2aa2611d33
 ---> 4e1687c3514f
Step 7/7 : COPY . /code/
 ---> abe16389806f

Successfully built abe16389806f
Successfully tagged books_web:latest
Creating books_db_1 ... done
Creating books_web_1 ... done

Administrator@notebook-pc MINGW64 /c/python/django_professionals/code/books
$ docker-compose logs
Attaching to books_web_1, books_db_1
web_1  | python: can't open file '/code/manage.py': [Errno 2] No such file or di
rectory
db_1   | ***********************************************************************
*********
db_1   | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will a
llow
db_1   |          anyone with access to the Postgres port to access your databas
e without
db_1   |          a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
db_1   |          documentation about "trust":
db_1   |          https://www.postgresql.org/docs/current/auth-trust.html
db_1   |          In Docker's default configuration, this is effectively any oth
er
db_1   |          container on the same system.
db_1   |
db_1   |          It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust.
Replace
db_1   |          it with "-e POSTGRES_PASSWORD=password" instead to set a passw
ord in
db_1   |          "docker run".
db_1   | ***********************************************************************
*********
db_1   | The files belonging to this database system will be owned by user "post
gres".
db_1   | This user must also own the server process.
db_1   |
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   |
db_1   | Data page checksums are disabled.
db_1   |
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... o
k
db_1   | creating subdirectories ... ok
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting default time zone ... Etc/UTC
db_1   | creating configuration files ... ok
db_1   | running bootstrap script ... ok
db_1   | performing post-bootstrap initialization ... ok
db_1   | syncing data to disk ... ok
db_1   |
db_1   | initdb: warning: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A, or
db_1   | --auth-local and --auth-host, the next time you run initdb.
db_1   |
db_1   | Success. You can now start the database server using:
db_1   |
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   |
db_1   | waiting for server to start....2020-06-13 00:12:08.901 UTC [46] LOG:  s
tarting PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compil
ed by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2020-06-13 00:12:08.902 UTC [46] LOG:  listening on Unix socket "/var/r
un/postgresql/.s.PGSQL.5432"
db_1   | 2020-06-13 00:12:08.919 UTC [47] LOG:  database system was shut down at
 2020-06-13 00:12:08 UTC
db_1   | 2020-06-13 00:12:08.924 UTC [46] LOG:  database system is ready to acce
pt connections
db_1   |  done
db_1   | server started
db_1   |
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb
.d/*
db_1   |
db_1   | 2020-06-13 00:12:08.989 UTC [46] LOG:  received fast shutdown request
db_1   | waiting for server to shut down....2020-06-13 00:12:08.992 UTC [46] LOG
:  aborting any active transactions
db_1   | 2020-06-13 00:12:08.996 UTC [46] LOG:  background worker "logical repli
cation launcher" (PID 53) exited with exit code 1
db_1   | 2020-06-13 00:12:08.997 UTC [48] LOG:  shutting down
db_1   | 2020-06-13 00:12:09.009 UTC [46] LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   |
db_1   | PostgreSQL init process complete; ready for start up.
db_1   |
db_1   | 2020-06-13 00:12:09.130 UTC [1] LOG:  starting PostgreSQL 12.3 (Debian
12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0
, 64-bit
db_1   | 2020-06-13 00:12:09.131 UTC [1] LOG:  listening on IPv4 address "0.0.0.
0", port 5432
db_1   | 2020-06-13 00:12:09.131 UTC [1] LOG:  listening on IPv6 address "::", p
ort 5432
db_1   | 2020-06-13 00:12:09.137 UTC [1] LOG:  listening on Unix socket "/var/ru
n/postgresql/.s.PGSQL.5432"
db_1   | 2020-06-13 00:12:09.152 UTC [55] LOG:  database system was shut down at
 2020-06-13 00:12:09 UTC
db_1   | 2020-06-13 00:12:09.155 UTC [1] LOG:  database system is ready to accep
t connections

Administrator@notebook-pc MINGW64 /c/python/django_professionals/code/books
$ docker-compose up
books_db_1 is up-to-date
Starting books_web_1 ... done
Attaching to books_db_1, books_web_1
db_1   | ***********************************************************************
*********
db_1   | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will a
llow
db_1   |          anyone with access to the Postgres port to access your databas
e without
db_1   |          a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
db_1   |          documentation about "trust":
db_1   |          https://www.postgresql.org/docs/current/auth-trust.html
db_1   |          In Docker's default configuration, this is effectively any oth
er
db_1   |          container on the same system.
db_1   |
db_1   |          It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust.
Replace
db_1   |          it with "-e POSTGRES_PASSWORD=password" instead to set a passw
ord in
db_1   |          "docker run".
db_1   | ***********************************************************************
*********
db_1   | The files belonging to this database system will be owned by user "post
gres".
db_1   | This user must also own the server process.
db_1   |
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   |
db_1   | Data page checksums are disabled.
db_1   |
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... o
k
db_1   | creating subdirectories ... ok
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting default time zone ... Etc/UTC
db_1   | creating configuration files ... ok
db_1   | running bootstrap script ... ok
db_1   | performing post-bootstrap initialization ... ok
db_1   | syncing data to disk ... ok
db_1   |
db_1   | initdb: warning: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A, or
db_1   | --auth-local and --auth-host, the next time you run initdb.
db_1   |
db_1   | Success. You can now start the database server using:
db_1   |
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   |
db_1   | waiting for server to start....2020-06-13 00:12:08.901 UTC [46] LOG:  s
tarting PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compil
ed by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1   | 2020-06-13 00:12:08.902 UTC [46] LOG:  listening on Unix socket "/var/r
un/postgresql/.s.PGSQL.5432"
db_1   | 2020-06-13 00:12:08.919 UTC [47] LOG:  database system was shut down at
 2020-06-13 00:12:08 UTC
db_1   | 2020-06-13 00:12:08.924 UTC [46] LOG:  database system is ready to acce
pt connections
db_1   |  done
db_1   | server started
db_1   |
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb
.d/*
db_1   |
db_1   | 2020-06-13 00:12:08.989 UTC [46] LOG:  received fast shutdown request
db_1   | waiting for server to shut down....2020-06-13 00:12:08.992 UTC [46] LOG
:  aborting any active transactions
db_1   | 2020-06-13 00:12:08.996 UTC [46] LOG:  background worker "logical repli
cation launcher" (PID 53) exited with exit code 1
db_1   | 2020-06-13 00:12:08.997 UTC [48] LOG:  shutting down
db_1   | 2020-06-13 00:12:09.009 UTC [46] LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   |
db_1   | PostgreSQL init process complete; ready for start up.
db_1   |
db_1   | 2020-06-13 00:12:09.130 UTC [1] LOG:  starting PostgreSQL 12.3 (Debian
12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0
, 64-bit
db_1   | 2020-06-13 00:12:09.131 UTC [1] LOG:  listening on IPv4 address "0.0.0.
0", port 5432
db_1   | 2020-06-13 00:12:09.131 UTC [1] LOG:  listening on IPv6 address "::", p
ort 5432
db_1   | 2020-06-13 00:12:09.137 UTC [1] LOG:  listening on Unix socket "/var/ru
n/postgresql/.s.PGSQL.5432"
db_1   | 2020-06-13 00:12:09.152 UTC [55] LOG:  database system was shut down at
 2020-06-13 00:12:09 UTC
db_1   | 2020-06-13 00:12:09.155 UTC [1] LOG:  database system is ready to accep
t connections
web_1  | python: can't open file '/code/manage.py': [Errno 2] No such file or di
rectory
books_web_1 exited with code 2

There is another one problem persists:还有一个问题仍然存在:

web_1 | web_1 | python: can't open file '/code/manage.py': [Errno 2] No such file or directory python:无法打开文件'/code/manage.py':[Errno 2]没有这样的文件或目录

It creates two images.... Creating books_db_1... done Creating books_web_1... done它创建了两个图像....创建 books_db_1... 完成 创建 books_web_1... 完成

They are displayed in Kitematic (Alpha) although books_web_1 is stopped.尽管books_web_1已停止,但它们仍以 Kitematic (Alpha) 显示。 When I try to start it I get an error python: can't open file '/code/manage.py': [Errno 2] No such file or directory当我尝试启动它时,出现错误python: can't open file '/code/manage.py': [Errno 2] No such file or directory

As for localhost, should I use somewhere network_mode: host parameter?至于 localhost,我应该在某处使用network_mode: host参数吗?

Oh, eventually... I've watched a video by Bret Fisher who said that it would be impossible to run a project from a directory none other than \User\USERNAME哦,最终...我看过 Bret Fisher 的视频,他说不可能从 \User\USERNAME 以外的目录运行项目

Once I copied it there (mind.... that there could be many of them, you should copy it into a user's directory you're currently logged in PROVIDED you're an administrator if not copy the project to the administrator directory. My computer is a part of a domain therefore the latter is the case of mine.一旦我将它复制到那里(请注意....可能有很多,您应该将其复制到您当前登录的用户目录中,前提是您是管理员,如果不将项目复制到管理员目录。我的计算机是域的一部分,因此后者是我的情况。

The only thing I didn't work out yet.... is how to run a web server on localhost... It only opens a web page at http://192.168.99.100:8000唯一我还没有解决的问题......是如何在本地主机上运行 web 服务器......它只会在http0: 801 处打开一个 web 页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows 客户端无法与在 linux docker 容器中运行的服务器通信 - Windows client can't communicate with server running in linux docker container 为什么我无法从 docker 容器内连接到我的服务器? - Why can't I connect to my server from within a docker container? 在我的情况下如何在Docker中启动容器 - How to start the container in Docker in my case 为什么我无法连接到docker容器中的flask服务器? - Why can't I connect to the flask server in docker container? Docker 容器找不到文件,即使我看到它 - Docker container can't find file even though I see it Docker Run [tag-name to container] 返回 python:无法在 Windows 中打开文件 - Docker Run [tag-name to container] returns python: can't open file in Windows 我无法在Windows7中成功启动蟒蛇构造函数 - I can't start successfully boa constructor in windows7 无法让我的 python 应用程序在 docker 容器中启动 - Cant get my python app to start in a docker container 如何为我的 Flask 应用程序从 Elastic Beanstalk 到我的 Docker 容器的端口 map? - How can I map a port from Elastic Beanstalk to my Docker container for my Flask app? 无法将摇摇欲坠的服务器加入Docker容器 - Can't acces swagger server into docker container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM