我成功地检索到一个名为
k8s.gcr.io/guestbook:v3
从公共存储库中运行,并使用
Docker Toolbox.
(我必须使用Docker工具箱,因为所讨论的devbox不满足安装的先决条件)
Docker for Windows
)
为了定位和打开用于创建图像的文件,需要键入哪些特定命令?
我想检查容器中应用程序的代码,然后在这里和那里进行一些更改,然后将修订后的图像作为容器运行,以查看修订后的代码是否有效。但如果我不能首先访问代码,我就不能很好地做到这一点。
下载图像并运行容器
以下是我为检索和验证容器/映像而采取的步骤:
User@pc MINGW64 /c/Program Files/Docker Toolbox
$ docker run -d -p 3000:3000 k8s.gcr.io/guestbook:v3
Unable to find image 'k8s.gcr.io/guestbook:v3' locally
v3: Pulling from guestbook
a3ed95caeb02: Pull complete
300273678d06: Pull complete
de2a362ef050: Pull complete
06d5067149bd: Pull complete
7a38a4e8f983: Pull complete
10af2c65b7d4: Pull complete
Digest: sha256:8f333d5b72677d216b4eb046d655aef7be9f1380e06ca1c63dfa9564034e7e26
Status: Downloaded newer image for k8s.gcr.io/guestbook:v3
953785bda17b0396fa3f3812a9b8ad8e2038120336895dfe1d57343adb917cce
User@pc MINGW64 /c/Program Files/Docker Toolbox
$ curl $(docker-machine ip default):3000
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta charset="utf-8">
<meta content="width=device-width" name="viewport">
<link href="style.css" rel="stylesheet">
<title>Guestbook</title>
</head>
<body>
<div id="header">
<h1>Guestbook</h1>
</div>
<div id="guestbook-entries">
<p>Waiting for database connection...</p>
</div>
<div>
<form id="guestbook-form">
<input autocomplete="off" id="guestbook-entry-content" type="text">
<a href="#" id="guestbook-submit">Submit</a>
</form>
</div>
<div>
<p><h2 id="guestbook-host-address"></h2></p>
<p><a href="env">/env</a>
<a href="info">/info</a></p>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="script.js"></script>
</body>
</html>
User@pc MINGW64 /c/Program Files/Docker Toolbox
$