我刚刚在他们的网页上安装了Docker-Toolbox
我开始Docker QuickStart Terminal
并看到以下
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ 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
bash-3.2$
Run Code Online (Sandbox Code Playgroud)
但是当我尝试表演时docker pull hello-world
,这就是我所看到的
bash-3.2$ docker run hello-world
Unable to find image 'hello-world:latest' locally
Pulling repository docker.io/library/hello-world …
Run Code Online (Sandbox Code Playgroud) 在我Dockerfile
使用curl
或ADD
下载最新版本的存档,如:
FROM debian:jessie
...
RUN apt-get install -y curl
...
RUN curl -sL http://example.com/latest/archive.tar.gz --output archive.tar.gz
...
ADD http://example.com/latest/archive2.tar.gz
...
Run Code Online (Sandbox Code Playgroud)
RUN
使用curl
或ADD
创建自己的图像层的语句.这将用作未来执行的缓存docker build
.
问题:如何禁用该指令的缓存?
在那里工作缓存失效之类的东西会很棒.例如,通过使用HTTP ETag或通过查询最后修改的头字段.这样就可以根据HTTP标头进行快速检查,以确定是否可以使用缓存层.
我知道一些肮脏的技巧可以帮助例如在RUN
语句中执行下载shell脚本.它的文件名将在docker build
我们的构建系统触发之前更改.我可以在该脚本中进行HTTP检查.但后来我需要将最后使用过的ETag或最后修改过的文件存储到某个文件中.我想知道是否有一些我可以使用的更干净和原生的 Docker功能,在这里.
我正在使用java:7u79
基于的图像在Docker容器中运行dropwizard Java应用程序debian/jessie
.
我的Java应用程序处理SIGTERM
信号以正常关闭.SIGTERM
当我运行没有Docker的应用程序时,处理工作非常完美.
当我在Docker容器中运行它SIGTERM
时,当我发出docker stop
命令时,它不会到达Java应用程序.它在10秒后突然杀死了这个过程.
我的Dockerfile
:
FROM java:7u79
COPY dropwizard-example-1.0.0.jar /opt/dropwizard/
COPY example.keystore /opt/dropwizard/
COPY example.yml /opt/dropwizard/
WORKDIR /opt/dropwizard
RUN java -jar dropwizard-example-1.0.0.jar db migrate /opt/dropwizard/example.yml
CMD java -jar dropwizard-example-1.0.0.jar server /opt/dropwizard/example.yml
EXPOSE 8080 8081
Run Code Online (Sandbox Code Playgroud)
这有什么问题Dockerfile
?有没有其他方法可以解决这个问题?
我创建了两个Docker容器.第一个提供私有Docker注册表,第二个是官方Docker注册表的镜像:
docker run -d --name registry -v /local/path/to/registry:/registry -e SETTINGS_FLAVOR=local -e STORAGE_PATH=/registry -p 5000:5000 registry
docker run -d --name mirror -v /local/path/to/mirror:/registry -e STORAGE_PATH=/registry -e STANDALONE=false -e MIRROR_SOURCE=https:/registry-1.docker.io -e MIRROR_SOURCE_INDEX=https://index.docker.io -p 5555:5000 registry
Run Code Online (Sandbox Code Playgroud)
现在我想两者结合起来.每当用户提取图像时,它应首先查询私有注册表,然后查询镜像.当图像被推送时,它们应该只被推送到私人注册表.
我不知道如何做到这一点.任何帮助表示赞赏.
我正在发现码头,我跟着官方网站的入门部分.但是, 当您被要求从docker文件构建新映像时,我会陷入步骤2 中的"构建您自己的映像"部分链接.我正在使用OSX Yosemite,我运行的所有内容都来自Boot2Docker终端.
这是教程中的dockerfile:
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortunes -a | cowsay
Run Code Online (Sandbox Code Playgroud)
我建立了图像
docker build -t docker-whale .
Run Code Online (Sandbox Code Playgroud)
apt做了它的东西,并在安装财富时向我显示以下日志
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Run Code Online (Sandbox Code Playgroud)
这是因为没有设置TERM环境变量所以添加行
ENV …
Run Code Online (Sandbox Code Playgroud) 我正在尝试配置一个Docker容器,在Ubuntu 14上运行tengine ,以使用syncookies.但是我面临一些问题.
主机已net.ipv4.tcp_syncookies=1
启用,syncookies直接在主机上工作.但是同一主机上的容器不使用syncookies.
有没有人知道让容器使用syncookies的方法?
提前致谢 :).
我是初学者,所以如果我问任何明显的话,请记住我.我正在尝试使用apk安装到我的设备,adb install apk.apk
然而,apk大约几百MB,需要一些时间.是否有某种进度条可以在命令窗口中实现以显示进度?我见过adb push/pull的东西.我不确定它是否相同.我在Windows 8.1中运行它.我还设置了adb环境变量.
非常感谢.
我试图找到二叉树的尾递归折叠函数.鉴于以下定义:
// From the book "Functional Programming in Scala", page 45
sealed trait Tree[+A]
case class Leaf[A](value: A) extends Tree[A]
case class Branch[A](left: Tree[A], right: Tree[A]) extends Tree[A]
Run Code Online (Sandbox Code Playgroud)
实现非尾递归函数非常简单:
def fold[A, B](t: Tree[A])(map: A => B)(red: (B, B) => B): B =
t match {
case Leaf(v) => map(v)
case Branch(l, r) =>
red(fold(l)(map)(red), fold(r)(map)(red))
}
Run Code Online (Sandbox Code Playgroud)
但现在我正在努力寻找尾递归折叠函数,以便@annotation.tailrec
可以使用注释.
在我的研究过程中,我发现了一些例子,其中树上的尾递归函数可以例如使用自己的堆栈计算所有叶子的总和,然后基本上是a List[Tree[Int]]
.但据我所知,在这种情况下它只适用于添加,因为无论您是首先评估运算符的左侧还是右侧都不重要.但对于广义折叠来说,它是非常相关的.为了表明我的意图,这里有一些示例树:
val leafs = Branch(Leaf(1), Leaf(2))
val left = Branch(Branch(Leaf(1), Leaf(2)), Leaf(3))
val right = Branch(Leaf(1), Branch(Leaf(2), Leaf(3)))
val …
Run Code Online (Sandbox Code Playgroud) 我似乎无法让我的 dockerfile 缓存我的 npm 安装。我按照所有示例指定的方式对其进行了设置,并且 package.json 不会更改,但它仍会下载所有依赖项。
这是我所拥有的
FROM mf/nodebox
# Maintainer
MAINTAINER Raif Harik <reharik@gmail.com>
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
ADD /app/package.json /tmp/package.json
RUN cd /tmp && npm install && npm install -g babel
RUN cd /tmp && cp -a /tmp/node_modules /opt/app/current/node_modules
# Entrypoint to docker shell
ENTRYPOINT ["docker-shell"]
#this is the flag that tells the docker-shell what mode to execute
# Startup commands
CMD ["-r"]
# set WORKDIR
WORKDIR /opt/app/current
# Add shell script for …
Run Code Online (Sandbox Code Playgroud) 我试图从我的docker-compose设置基本的postgres信息.容器启动但Dockerfile
运行时不会覆盖来自的变量docker-compose up
.请帮忙.
FROM mine/debian7
## START: UPDATES & INSTALLS ###########################################################################################
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" >> /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - && \
apt-get update && \
apt-get upgrade && \
apt-get install -y python-software-properties software-properties-common postgresql-9.4 postgresql-client-9.4 postgresql-contrib-9.4 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## END: UPDATES & INSTALLS #############################################################################################
ENV DB_USER_NAME test
ENV DB_PASSWORD test
ENV DB_NAME test
## START: CONCFIGURATION …
Run Code Online (Sandbox Code Playgroud) docker ×8
caching ×2
dockerfile ×2
adb ×1
android ×1
binary-tree ×1
boot2docker ×1
build ×1
command ×1
curl ×1
dropwizard ×1
fold ×1
image ×1
java ×1
line ×1
macos ×1
node.js ×1
npm ×1
scala ×1
tree ×1