如何在不使用存储库的情况下将Docker镜像从一台计算机传输到另一台计算机,无论是私有还是公共?
我习惯在VirtualBox中播放并创建自己的图像,当它完成后,我尝试部署到其他机器上以实现真正的用途.
由于它基于自己的映像(如Red Hat Linux),因此无法从Dockerfile重新创建它.
我可以使用简单的命令吗?或另一种解决方案
看来save/export可以达到类似的目的,看看Docker中保存和导出有什么区别?,我更喜欢save我的情况下的命令.
我在Windows中使用Git,并希望通过一次提交将可执行shell脚本推送到git repo.
通常我需要做两个步骤(git commit).
$ vi install.sh
$ git add install.sh
$ git commit -am "add new file for installation" # first commit
[master f2e92da] add support for install.sh
1 files changed, 18 insertions(+), 3 deletions(-)
create mode 100644 install.sh
$ git update-index --chmod=+x install.sh
$ git commit -am "update file permission" # second commit
[master 317ba0c] update file permission
0 files changed
mode change 100644 => 100755 install.sh
Run Code Online (Sandbox Code Playgroud)
如何将这两个步骤合并为一步?git配置?Windows命令?
提醒:两个答案都很好,git add --chmod=+x file新git版本支持
参考: …
我尝试找到Docker镜像的一个特定标签.我怎么能在命令行上这样做?我尽量避免全部下载并删除不需要的图像.
在官方的Ubuntu版本中,https://registry.hub.docker.com/_/ubuntu/,有几个标签(发布它),而当我在命令行上搜索它时,
user@ubuntu:~$ docker search ubuntu | grep ^ubuntu
ubuntu Official Ubuntu base image 354
ubuntu-upstart Upstart is an event-based replacement for ... 7
ubuntufan/ping 0
ubuntu-debootstrap 0
Run Code Online (Sandbox Code Playgroud)
另外在命令行search https://docs.docker.com/engine/reference/commandline/search/的帮助下,不知道它是如何工作的?
在docker search命令中可以吗?
如果我使用原始命令通过Docker注册表API进行搜索,则可以获取信息:
$ curl https://registry.hub.docker.com//v1/repositories/ubuntu/tags | python -mjson.tool
[
{
"layer": "ef83896b",
"name": "latest"
},
.....
{
"layer": "463ff6be",
"name": "raring"
},
{
"layer": "195eb90b",
"name": "saucy"
},
{
"layer": "ef83896b",
"name": "trusty"
}
]
Run Code Online (Sandbox Code Playgroud) 我们经常做的一件事是在Dockerfile构建Docker镜像时打包所有源代码.
ADD . /app
Run Code Online (Sandbox Code Playgroud)
我们怎样才能避免.git以简单的方式包含目录?
我试过用Unix来处理这个问题的方法 ADD [^.]* /app/
完整样本:
docker@boot2docker:/mnt/sda1/tmp/abc$ find . . ./c ./.git ./Dockerfile ./good ./good/a1 docker@boot2docker:/mnt/sda1/tmp/abc$ cat Dockerfile FROM ubuntu ADD [^.]* /app/ docker@boot2docker:/mnt/sda1/tmp/abc$ docker build -t abc . Sending build context to Docker daemon 4.096 kB Sending build context to Docker daemon Step 0 : FROM ubuntu ---> 04c5d3b7b065 Step 1 : ADD [^.]* /app/ d ---> 5d67603f108b Removing intermediate container 60159dee6ac8 Successfully built 5d67603f108b docker@boot2docker:/mnt/sda1/tmp/abc$ docker run -it abc root@1b1705dd66a2:/# …
我生成默认的Maven快速入门例子,和类型mvn checkstyle:checkstyle,它总是尝试使用最新的SNAPSHOT版本.也许这是错误的,我的Nexus服务器,但我怎么可以设置插件的命令行版本的Maven 2,喜欢2.5的CheckStyle的,而不是2.6-SNAPSHOT?
C:\HelloWorld>mvn checkstyle:checkstyle
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'checkstyle'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-checkstyle-plugin
Reason: Error getting POM for 'org.apache.maven.plugins:maven-checkstyle-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
org.apache.maven.plugins:maven-checkstyle-plugin:pom:2.6-SNAPSHOT
from the specified remote repositories:
nexus …Run Code Online (Sandbox Code Playgroud) Jenkins有600多个插件,在真实系统中,我们习惯于安装大量插件.
有时,我们想删除一些插件以使系统更干净或用另一个成熟的插件(不同的名称)替换.
这需要确保没有人/没有工作使用这些插件或我需要通知他们.
在Jenkins系统中是否有任何配置或知道该插件是否被任何作业使用的方法?
更新2013 根据下面的答案,我维护简单的"插件:关键字"映射,如
plugin_keys = {
"git":'scm class="hudson.plugins.git.GitSCM"',
"copyartifact":"hudson.plugins.copyartifact.CopyArtifact",
# and more
}
Run Code Online (Sandbox Code Playgroud)
并从中搜索plugin关键字config.xml,可以通过jenkins远程API获取所有信息(插件,作业,配置)
这个对我有用.
更新2014.04.26 后来的jenkins版本,似乎config.xml被更改为直接有插件名称
喜欢
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.4">
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@1.7.2">
<hudson.plugins.disk__usage.DiskUsageProperty plugin="disk-usage@0.18"/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@1.4.1-SNAPSHOT">
Run Code Online (Sandbox Code Playgroud)
因此,我只是检查这个plugin="<plugin name>"中config.xml,它再次工作
更新2014.05.05
请参阅gist jenkins-stats.py中的完整脚本
更新2018.6.7
有插件使用的插件支持这个(没有REST API还)
我们有几个自己的python包,并希望使用简单的界面为他们创建本地pypi存储库,如https://pypi.python.org/simple/
由于安全原因,我想在没有任何镜像的情况下为本地创建此存储库,它将被置于apache的控制之下
命令pypimirror看起来必须初始化一次,需要镜像.
如何基于本地python包生成PyPi Simple Index.
还有其他任何简单的脚本吗?
我找不到如何在私人注册表中管理图像.我可以推或拉图像因为我知道id但是如何获得推送图像列表?
例如,想要在其组织的私人注册表下查看可用图像的人.她怎么办?
除非我弄错了,否则我找不到API或Web UI来发现注册表内容,例如index.docker.io对公共注册表的处理.
是否有任何开源项目来管理这个?
谢谢.
Python请求是一个很好的模块,可以简化我的Web REST API访问编程,我通常会在下面做
import json
url = 'https://api.github.com/some/endpoint'
payload = {'some': 'data'}
headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
r = requests.post(url, data=json.dumps(payload), headers=headers)
Run Code Online (Sandbox Code Playgroud)
当出现错误时,我想看看它背后发生了什么.构造curl命令以在命令行中重现是常见的方法,因为这是RESP API文档中最常描述的标准方法
try:
r = requests.post(url, data=json.dumps(payload), headers=headers)
except Exception as ex:
print "try to use curl command below to reproduce"
print curl_request(url,"POST",headers,payload)
Run Code Online (Sandbox Code Playgroud)
我可以curl为这个请求生成命令示例,在libcloud的调试中看到很好的例子,我找不到一个简单的构造方法,下面是我想要自己创建的方法.
# below code is just pseudo code, not correct
def curl_request(url,method,headers,payloads):
# construct curl sample from requests' structure
# $ curl -v -H "Accept: application/json" -H …Run Code Online (Sandbox Code Playgroud) 我需要在Docker中设置我自己的私有注册表,通常保留所有内部Docker镜像.
为了使这更容易,我希望在内部设置我的Docker图像被调用project/component,就像你从https://index.docker.io/提取的普通Docker图像一样.
我确信,我永远不会从index.docker.io中获取这种格式的图像,所有这些图像都来自我们的内部索引器.即使是格式的图像imagename,centos也会从我们的内部存储库中提取出来.
那么,有没有办法让我更改默认索引器?或者至少将我的私有索引器从端口5000更改为默认尝试的东西; 即,从中获取图像private_indexer.internal/repo_name而不是private_indexer.internal:5000/repo_name.
将index.docker.io放在我们自己的dns中指向我们的内部ip是最好的解决方案吗?