Tag: dockerfile

Docker:Dockerize在/ opt / my-service / db文件夹中需要mmdb文件的服务

我正在试图dockerize需要mmdb文件(maxmind数据库文件格式)在一个特定的位置/ opt / my-service / db 本地我能够运行该服务,如果我通过将所需的mmdb文件复制到“ / opt / my-service / db ”文件夹来设置我的系统。 我应该为docker工做些什么? 我试图通过在dockerfile中创build相同的文件位置(不工作)来复制文件: FROM tomcat:8-jre8 EXPOSE 8080 COPY ./my-service/target/my-service-1.0-SNAPSHOT.war /usr/local/tomcat/webapps cmd mkdir -p /opt/my-service/db copy ./my-service/src/test/resources/* /opt/ipgeo/db/ CMD ["catalina.sh", "run"] 这是应该如何做? 或者应该创build一个容器? 如果是的话,怎么样?

cv2.VideoCapture不能在mac主机上的docker容器中工作

我无法打开networking摄像头或在Mac OS Sierra 10.12.6主机上的Ubuntu 16.04泊坞窗容器中捕捉video。 vid = cv2.VideoCapture(0) 其中vid.isOpened()返回False和ret, img = vid.read()返回False, None 我没有使用从PIP OpenCV。 我从源代码编译cv2。 应该安装ffmpeg。 容器是否无法连接到networking摄像头设备? 我试着运行docker: docker run -it –privileged –device=/dev/video0:/dev/video0 –entrypoint /bin/bash <ImageID> 我的dockerfile如下: # # Ubuntu Dockerfile # # https://github.com/dockerfile/ubuntu # # Pull base image. FROM ubuntu:16.04 # Install. RUN \ sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ apt-get update […]

用https使用dockerfile克隆位桶回购。如何传递密码?

我有一个docker文件。 其中我必须克隆使用https url的bitbucket存储库,但我如何传递密码,使克隆完成? 是的,我试过SSH。它的作品,但我需要https克隆一些shell脚本运行,以便它应该自动接受密码。 这是我的docker命令来克隆repo: 运行git克隆https://username@bitbucket.org/abc/xyz.git 这里是我在buildind docker文件时得到的错误:\ 克隆到“新文件夹”…致命:无法读取“ https://username@bitbucket.org ”的密码:没有这样的设备或地址 我的build立命令是: sudo docker build –no-cache = true -t image:build。

使用Docker从Java应用程序连接到MySQL数据库

我是Docker的新手。 我想让我的Java应用程序与MySQL数据库连接。 我有以下代码: import java.sql.*; class HelloDbDocker{ private static String jdbcDriver = "com.mysql.jdbc.Driver"; private static String dbName = "employee"; public static void main(String[] args) { try { Class.forName(jdbcDriver); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/?user=root&password="); Statement s = conn.createStatement(); int Result = s.executeUpdate("CREATE DATABASE "+dbName); System.out.println(Result ); } catch(Exception e) { System.out.println(e); } } } 对于上面的代码,我想创build一个Dockerfile,它提供所有的依赖关系,并使用该Dockerfile我可以创build一个图像,它可以运行在任何地方,并显示结果variables的值在屏幕上。

在Docker容器中部署Golang应用程序

我需要将安静的应用程序部署到Docker容器中。 我的项目有以下结构 go_proj |- bin |- src | | |- com.example | | | |- web_service.go | | | |- github.com.gorilla.mux | | | – … |- Dockerfile 我的Dockerfile应该如何? 也许我应该从容器中下载库(mux)?

在Docker-Compose上运行时找不到模块

我准备在生产中使用Dockerfile。 但由于某种原因,最后一条命令返回错误。 react_1 | [WEBPACK] Building 1 target react_1 | [WEBPACK] Started building bundle.[chunkhash].js react_1 | [WEBPACK] Build failed after 33.631 seconds react_1 | [WEBPACK] Errors building bundle.[chunkhash].js react_1 | Module not found: Error: Can't resolve './App' in '/home/app/react/src' 这是docker文件的副本 Dockerfile.prod FROM node:7.10.1-alpine RUN apk update ENV HOME=/home/app COPY . $HOME/react/ RUN npm install yarn […]

使用Docker:如何扭曲Web应用程序与nginx Web服务器进行通信

我是使用Docker的新手。 我想用微服务架构方法重build我的单一应用程序。 我有一个需要与nginx服务器交互的Flask应用程序服务器。 传统上我们使用Gunicorn作为uWSGI,但是我们怎么能用Docker做同样的事? 以下是我的代码, 我有一个Flask应用程序,要求用户上传一个Excel文件 from flask import Flask, request, render_template import os app = Flask(__name__) default_key = '1' app.config["UPLOAD_FOLDER"] = "/app" @app.route('/', methods=['GET', 'POST']) def mainpage(): if request.method == 'POST': print request.form if request.method == 'POST' and request.form['submit'] == 'Check Results' : #TODO: copy the file into named volume f = request.files['file'] filename […]

使用docker与卡拉夫

我是新来的docker工人,我想在我的卡拉夫容器上部署一场战争。我找不到足够的例子来理解如何去做这件事。现在,这就是我所做的 安装docker工具箱 与我的战争healthmonitor在其中创build一个文件夹。 创build一个Dockerfile,其中包含如下所述的内容 添加我的战争信息。因此,我的最终Dockerfile看起来像这样 FROM centos:7 RUN yum update -y && yum -y install java-1.8.0-openjdk-devel openssh-clients && yum clean all RUN groupadd -r karaf -g 1000 && useradd -u 1000 -r -g karaf -m -d /opt/karaf -s /sbin/nologin -c "Karaf user" karaf && \ chmod 755 /opt/karaf WORKDIR /opt/karaf ADD shell /opt/karaf RUN chmod […]

无法通过Docker Image中的套接字错误连接到本地MySQL服务器

我正在创build一些示例数据的MySQL图像。 我正在尝试在图像创build期间启动mysql进程时出现错误,以便可以将数据放入图像中。 以下是我的文件结构 [DockerFile] FROM mysql:5.6.29 # MYSQL volumes VOLUME ["/etc/mysql", "/var/lib/mysql"] COPY data_dump.sql /tmp/ COPY init_db.sh /tmp/ RUN chmod -R 777 /tmp/init_db.sh RUN chmod -R 777 /tmp/data_dump.sql RUN /tmp/init_db.sh EXPOSE 3306 [init_db.sh] #!/bin/bash echo "starting the bash command" /usr/bin/mysqld_safe & echo "started the mysqld_safe process" sleep 15 mysql -u root -h localhost -e "CREATE […]

docker构build如何使用centos运行中间容器:systemd

我正在尝试构build一个基于centos:systemd的docker映像。 在我的Dockerfile中,我正在运行一个依赖于systemd运行的命令,失败的原因如下: Failed to get D-Bus connection: Operation not permitted error: %pre(mod-php-7.1-apache2-zend-server-7.1.7-16.x86_64) scriptlet failed, exit status 1 Error in PREIN scriptlet in rpm package mod-php-7.1-apache2-zend-server-7.1.7-16.x86_64 我怎么能得到中间容器运行 – –privileged和映射-v /sys/fs/cgroup:/sys/fs/cgroup:ro ? 如果我注释掉安装程序,只是运行容器,手动执行安装程序,它工作正常。 这是Dockerfile FROM centos/systemd COPY ./ZendServer-9.1.0-RepositoryInstaller-linux.tar.gz /opt RUN tar -xvf /opt/ZendServer-9.1.0-RepositoryInstaller-linux.tar.gz -C /opt/ RUN /opt/ZendServer-RepositoryInstaller-linux/install_zs.sh 7.1 java –automatic