Tag: 泊坞窗

在这个Dockerfile中创buildPostgres用户名/密码在哪里?

所以我按照这个教程: https : //realpython.com/blog/python/django-development-with-docker-compose-and-machine/ 我已经把所有东西都运转起来了,但是还有一些事情我不能理解或者理解。 在主要的Docker-Compose中,我们有: web: restart: always build: ./web expose: – "8000" links: – postgres:postgres – redis:redis volumes: – /usr/src/app – /usr/src/app/static env_file: .env command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 2 -b :8000 postgres: restart: always image: postgres:latest ports: – "5432:5432" volumes: – pgdata:/var/lib/postgresql/data/ 你会注意到有一个env_file包含: DB_NAME=postgres DB_USER=postgres DB_PASS=postgres 我的问题是什么时候postgres用户和密码被设置? 如果我运行这个docker工具 – 组成一切正常,这意味着Web应用程序可以将凭据传递到postgress数据库并build立连接。 但是,我无法遵循,那些凭据是在哪里设置的。 我假设在基地postgres Dockerfile中,会有一些指令来设置数据库名称,用户名和密码。 […]

我怎样才能将后端和前端中的wordpress与docker容器分开?

我已经使用以下命令为此创build了两个容器: docker run –detach –name=test-mysql –env="MYSQL_ROOT_PASSWORD=mypassword" mysql 并且用命令docker inspect test-mysql我可以看到容器IP地址"IPAddress": "172.17.0.20", 之后,我试图连接它与MySQL,但我得到这个错误: can't connect to MySQL server on '172.17.0.20' (60) 但如果我这样做:“docker执行-ittestingmysql的bash”我可以连接它。 如果我想连接一个WordPress的前端到这个MySQL容器,我应该怎么做? 我试图与docker run –detach –name test-wordpress –link test-mysql:mysql wordpress但不工作,我什么都没有在本地:80

为什么我在运行top时看到postgres进程,尽pipe它只在Docker中运行?

我有一个运行Postgres的Docker实例,Postgres没有安装在主机上。 但是,如果我运行在主机上,我可以看到几个进程Postgres。 你能解释我为什么吗?

在osx上运行docker内bazeltestingenv

试图运行在ProcessBuilder运行java_test 。 简化testing的代码如下: @Test public void testDockerExecutable(){ System.out.println("======== running docker =============="); try { Process p = new ProcessBuilder("docker","version") .inheritIO() .start(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } } 从shell直接运行docker version给出了输出: Client: Version: 17.03.1-ce API version: 1.27 Go version: go1.7.5 Git commit: c6d412e Built: Tue Mar 28 00:40:02 2017 OS/Arch: darwin/amd64 Server: Version: […]

在docker中如何用铬来运行selenium

我在Docker中安装了google-chrome,但是当我运行我的python脚本selenium时,它失败了,如下所示: automation@1c17781fef0c:/topology-editor/test$ python test.py Traceback (most recent call last): File "test.py", line 27, in <module> browser = webdriver.Chrome() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__ desired_capabilities=desired_capabilities) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__ self.start_session(desired_capabilities, browser_profile) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute self.error_handler.check_response(response) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in […]

加载psycopg2模块时从'wheel'安装时出错

我正试图从包含wheel档案的本地软件包目录安装一些python需求。 我在Docker容器中安装需求。 我遵循的步骤是: $ pip install wheel # wheel runs, outputs .whl files to wheelhouse directory $ pip wheel –wheel-dir wheelhouse -r requirements.txt 然后,在我的Dockerfile : ADD requirements.txt /tmp/requirements.txt ADD wheelhouse /tmp/wheelhouse # install requirements. Leave file in /tmp for now – may be useful. RUN pip install –use-wheel –no-index –find-link /tmp/wheelhouse/ -r /tmp/requirements.txt 这工作 – […]

在Dockerfile中创build的数据库不会出现在正在运行的容器中

我已经创build了一个基于https://index.docker.io/u/nornagon/postgres/图像的Dockerfile。 我想创build一个Postgres数据库泊坞窗图像作为我的CI过程的一部分。 这是我的Dockerfile: FROM nornagon/postgres ADD sql sql ADD create_db.sh /src/ USER postgres RUN /src/create_db.sh CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"] 这里是RUN命令执行的create_db.sh bash脚本: #! /bin/bash /etc/init.d/postgresql start psql –command "CREATE USER queuespy WITH SUPERUSER PASSWORD 'queuespy';" createdb -O queuespy queuespy psql -l for i in /sql/tables/*.sql do psql –file=$i –dbname=queuespy done for i in /sql/static_data/*.sql […]

与docker为WordPress的端口转发

我是docker工的新手。 我跟着这里的教程https://www.youtube.com/watch?v=Pe6a8Jbvi9E创build一个WordPress站点与docker。 他正在用下面的命令解释端口转发, docker run –link=my_mysql:mysql -p 80:80 -d wordpress 据我了解,这将把主机端口80中的所有请求redirect到容器的端口80。 但是,这将如何与mysql的端口3306沟通? 而且在那个教程中,数据库的详细信息不是在wordpress的任何地方设置的,而是从db config的值取自哪里的? 有人可以解释吗? 对不起,如果这是非常基本的问题。

com.spotify.docker.client.DockerRequestException:请求错误:DELETE unix:// localhost:80 / v1.12 / containers / …:409

我正在开发一个Java应用程序,它使用Google Kubernetes在Apache Tomcat Docker Containers中部署Web工件。 我使用https://github.com/spotify/docker-client来执行Docker镜像和容器处理活动,并使用https://github.com/fabric8io/fabric8/tree/master/components/kubernetes-api Kubernetes相关的function。 在这个应用程序中,我添加了一个function,使用户能够移除用户部署的Web工件。 删除I时, 删除我用来生成所需数量的Pod复制副本的Kubernetes复制控制器 分别删除副本窗格(因为在Java API的相应方法中删除复制控制器时,不会自动删除窗格) 删除掉相应的服务创build 删除对应于已删除的窗格的Docker容器 最后,删除用于部署的Docker镜像 以下代码显示了已执行的删除function: public boolean remove(String tenant, String appName) throws WebArtifactHandlerException { String componentName = generateKubernetesComponentName(tenant, appName); final int singleImageIndex = 0; try { if (replicationControllerHandler.getReplicationController(componentName) != null) { String dockerImage = replicationControllerHandler.getReplicationController(componentName).getSpec() .getTemplate().getSpec().getContainers().get(singleImageIndex).getImage(); List<String> containerIds = containerHandler.getRunningContainerIdsByImage(dockerImage); replicationControllerHandler.deleteReplicationController(componentName); podHandler.deleteReplicaPods(tenant, appName); serviceHandler.deleteService(componentName); […]

docker上的应用程序商店应该在哪上传文件?

我正在构build一个Web应用程序,需要允许用户上传个人资料照片。 我希望应用程序是独立的,以便人们不需要拥有s3或其他云存储服务帐户。 最好把docker集装箱尽可能地抛弃,所以我想我应该创build一个卷。 所以我希望自动创build卷,所以在运行容器时不需要指定卷,但dockerfiles中的VOLUME指令的文档让我感到困惑。 VOLUME指令创build一个具有指定名称的挂载点,并将其标记为从本地主机或其他容器中持有外部安装的卷。 这是什么意思? 数据是由应用程序写的,它不是来自外部的源。