Tag: bash

从shell执行多个命令到docker容器

我试图做一个命令,从docker集装箱做一个bash,打开mongo,并用类似的东西提出请求 'db.test.find({});' 我正在阅读其他类似的文章没有成功。 这是我正在执行的命令。 docker exec -it mongoDB bash -c'mongo; 使用testing; db.test.find({})” 那个命令给了我这个 bash:-c:第0行:附近出现意外令牌的语法错误{}' bash:-c:第0行:mongo; 使用testing; db.test.find({})” 这可能吗? 我希望你能帮助我。 问候, 罗斯。

无法使用dockerfile运行shell脚本

我是新来的docker,我只是想在容器内复制贝壳,我想执行贝壳。 Dockerfile: FROM amazonlinux WORKDIR /opt ADD ./test_Install.sh /opt/test_Install.sh RUN chmod 777 /opt/test_Install.sh WORKDIR / RUN ./test_Install.sh 构build镜像: docker build -t "testinstallscript:dockerfile" . 当我使用命令"docker build -t "testinstallscript:dockerfile" ." 我得到以下错误: standard_init_linux.go:178:exec用户进程导致“没有这样的文件或目录” 命令'/opt/test_Install.sh'返回一个非零的代码:1 谁能告诉我我在这里做错了什么?

build筑后将ENTRYPOINT更改为容器

我有一个Dockerfile,结束于: ENTRYPOINT ["/bin/bash", "/usr/local/cdt-tests/run-tests.sh"] 在构build这个容器之后,我想运行它,但是不是执行这个bash脚本(run-tests.sh),而是想打开容器内的terminal窗口来检查文件系统。 如果没有ENTRYPOINT行,我可以这样做: docker build -tx . docker run -it x /bin/bash 我可以检查容器的文件。 但是,由于有一个入口点,那么该脚本将运行,而我无法检查容器的文件。 有什么我可以做进入容器窥探?

我如何让Mitmproxy Docker在Windows Bash上工作?

当我尝试在Windows bash上运行mitmproxy Docker容器时,出现Docker守护进程未运行的错误消息。 我怎样才能让它运行? docker run –rm -it -p 8080:8080 mitmproxy/mitmproxy docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.

使用sudo权限在docker容器中添加新用户

我试图build立一个docker文件,其中一个要求是用sudo权限创build一个用户。 这里是bash脚本 # quietly add a user without password adduser –quiet –disabled-password –shell /bin/bash –home /home/newuser –gecos "testuser" newuser # set password echo "testuser:testuser" | sudo chpasswd 和泊坞窗撰写文件。 FROM ros RUN apt-get update RUN apt-get install -y sudo ADD run.sh /usr/local/bin/run.sh RUN chmod +x /usr/local/bin/run.sh CMD ["/usr/local/bin/run.sh"] 当我运行这个版本时,我得到以下错误。 chpasswd: (user testuser) pam_chauthtok() failed, error: Authentication […]

Ubuntu上的Docker .Net Core应用程序不在localhost:8000中打开

我正在使用Ubuntu 16.04,我在Windows上有一个.Net Core的docker应用程序,并试图让它在Ubuntu上运行。 我有docker和.net核心运行没有错误。 当我运行“sudo docker-compose up”时,它运行服务器,正在监听“ http:// +:80” 。 但是我无法在浏览器中打开它。 在Windows上,我正在使用的每个人都可以在localhost:8000上加载它。 当我运行docker-compose时,这是我得到的: sudo docker-compose up Starting webui Starting projects_api Starting profile_api Starting identity_api Attaching to projects_api, profile_api, webui, identity_api profile_api | Hosting environment: Development profile_api | Content root path: /app projects_api | Hosting environment: Development profile_api | Now listening on: http://+:80 projects_api | Content […]

文件不是在Docker中创build的

我是Docker的新手,尝试构buildDocker镜像。 我只是创build了Docker文件,但得到一些错误,无法确定如何解决这个问题。 我的Docker文件代码是: FROM ubuntu MAINTAINER ravat RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html CMD [ "/bin/bash" ] 我得到的错误是: /bin/sh: 1: cannot create /home/ravata/Desktop/DockerDemo/index.html: Directory nonexistent

$(pwd) – 一级

我是bash / shell脚本世界的新手,我正在尝试做下面的工作,这可能很简单,但我无法弄清楚命令,如果有人能够帮助我,也指向我的一些文档关于shell脚本主题。 先谢谢你。 我的build.sh和Dockerfile驻留在名为.settings的文件夹下,并且该文件夹直接位于应用程序根目录下。 现在在我的build.sh和Dockerfile中,当我引用像$(pwd)或COPY的东西。 / apps /它可能无法正常工作,因为我的build.sh和Dockerfile不直接在应用程序根目录下。 我在上面引用的文件中可以使用什么命令。 希望我明确。 再次,这可能是非常简单的,因为我是这个领域的新手,我觉得有点困难。 inside build.sh, reference to $(pwd) docker run \ -u root \ –rm \ -v $(pwd):/app \ —-> this $(pwd) references the application root, but if I move this build.sh inside a folder called .settings then the $(pwd) context would change and I still […]

以完全错误的顺序回显打印variables

我正在试图创build一个string与将保存/发送到另一个位置的查询,这个string包含不同的variables。 我遇到的问题是variables的回声完全颠倒混合。 见下面的代码: tokenID=$(docker exec -ti $dockerContainerID /bin/sh -c "cat /tempdir/tokenfile.txt") serverName="asdasd" attQuery="$tokenID $serverName" agentRegQuery="$./opt/mule/bin/amc_setup -H $attQuery" echo TOKEN ID $tokenID echo SERVER NAME $serverName echo $attQuery echo $agentRegQuery 查找下面我收到的输出: TOKEN ID 29a6966f-fa0e-4f08-87eb-418722872d80—46407 SERVER NAME asdasd asdasdf-fa0e-4f08-87eb-418722872d80—46407 asdasdmule/bin/amc_setup -H 29a6966f-fa0e-4f08-87eb-418722872d80—46407

无法在Docker容器中执行二进制文件(“Operation not permitted”)

问题 我正在构build一个Docker容器(基于RHEL),其中包含来自第三方存储库的自定义二进制文件。 在容器中执行二进制文件时,我收到一个不起眼的错误:“ Operation not permitted ”。 分析 Dockerfile Dockerfile非常简单。 FROM dockerregistry.example.com/rhel7:latest RUN yum -y install \ curl \ custom-package && \ curl -Lsq https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 > /sbin/dumb-init && \ chmod 755 /sbin/dumb-init && \ yum clean all ADD custom-package.conf /etc/custom-package/custom-package.conf ENTRYPOINT ["/sbin/dumb-init", "–"] CMD ["/usr/local/custom-package/bin/custom-package", "–config", "/etc/custom-package/custom-package.conf"] build立图像 我使用以下命令构build并在我的工作站上input容器。 $ docker build -t custom-package:v1 . […]