从Dockerfile创建映像 [英] Create an image from a Dockerfile
问题描述
我正在查看这样的Docerfile:
I am looking at a Docerfile like this:
FROM microsoft/aspnetcore:2.0 AS base
# Install the SSHD server
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssh-server \
&& mkdir -p /run/sshd \
&& echo "root:Docker!" | chpasswd
#Copy settings file. See elsewhere to find them.
COPY sshd_config /etc/ssh/sshd_config
COPY authorized_keys root/.ssh/authorized_keys
# Install Visual Studio Remote Debugger
RUN apt-get install zip unzip
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
EXPOSE 2222
<我正在尝试使用此dockerfile创建映像。我怎样才能做到这一点?在过去的几个小时中,我已经阅读了许多网页此 https://odewahn.github.io/docker- jumpstart / building-images-with-dockerfiles.html ,但是由于我的研究告诉我只需要一个命令,它们似乎都使它变得过于复杂。
I am trying to create an image using this dockerfile. How can I do this? I have read many webpages over the last few hours e.g. this one https://odewahn.github.io/docker-jumpstart/building-images-with-dockerfiles.html, however they all seem to overcomplicate it as my research is telling me that there is only one command needed.
推荐答案
由于拥有Docker文件,因此您需要执行4个附加步骤:
Since you have a Docker file, you are required to do 4 additional steps:
-
docker build -t< app-name> 。
:构建映像
docker映像
:检查您的映像
docker run -d -p 2222:8080 myapp
:运行您的图片
docker ps
:检查正在运行的docker image
docker ps
: Check running docker image
请参阅 Docker文档。以获取更多详细信息
Refer Docker doc. for more detials
这篇关于从Dockerfile创建映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!