我想要构建一个docker容器,它可以在任何系统上运行HTML文件,只需要用户键入docker run...
即可。 这是HTML代码:Docker - 在docker中运行一个HTML文件
<!doctype html>
<html>
<style>
body {
padding: 20px 5%;
color: white;
font-family: Sabon, serif;
margin: auto;
max-width: 800px;
}
@media (min-width: 600px) {
}
</style>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>D & T</title>
</head>
<body>
<center>
<div id="headline">
<header>
<h1>Date and Time</h1>
<p></p>
</header>
<div id="blurb">
<p>This page will show you your current local time.</p>
</div>
</div>
<div id="section1">
<h2></h2>
<p>It is now</p>
</div>
<div id="section2">
<script type="text/javascript">
document.write ('<p>----<span id="date-time">', new Date().toLocaleString(), '<\/span>----<\/p>')
if (document.getElementById) onload = function() {
setInterval ("document.getElementById ('date-time').firstChild.data = new Date().toLocaleString()", 50)
}
</script>
</div>
<div id="section3">
<div style="position: absolute; bottom: 5px">
<i>RG</i>
</div>
</div>
<footer>
<p><i>Created 26 May 2017</i></p>
</footer>
</center>
</body>
</html>
目前我正在尝试使用一个Ubuntu 14.04的环境和使用wget得到links2,然后使用XDG-开开HTML文件打开HTML文件。但我没有得到页面。 docker run...
只是没有做什么。没有错误,但没有网页。 这是我Dockerfile
:
FROM ubuntu:14.04
WORKDIR /app
ADD . /app
USER root
RUN apt-get update
RUN apt-get install --no-install-recommends xdg-utils
RUN apt-get install -y --no-install-recommends links2
RUN xdg-open datetime.html
任何的替代品或正确的解决方案?
“运行HTML文件” - 你什么意思?你想在浏览器中显示这个html或什么? – arbogastes
是的,在浏览器中。它甚至有可能吗? – user7091463