C# 如何从DockerFile方法为DockerDotNet BuildImageFromDockerfile创建流?
我正在尝试使用库构建Docker映像: Dockerfile:C# 如何从DockerFile方法为DockerDotNet BuildImageFromDockerfile创建流?,c#,docker,C#,Docker,我正在尝试使用库构建Docker映像: Dockerfile: #using ubuntu as having trouble with ssl on debian FROM ubuntu:14.04 #install php RUN apt-get update && apt-get install -y php5-cli #copy crontab, php script and data files container COPY my-crontab / COPY ge
#using ubuntu as having trouble with ssl on debian
FROM ubuntu:14.04
#install php
RUN apt-get update && apt-get install -y php5-cli
#copy crontab, php script and data files container
COPY my-crontab /
COPY getData.php /
COPY saveddata.xml /
#run crontab
RUN crontab /my-crontab
ENTRYPOINT cron -f
我通过将文件逐个添加到tar归档文件中,而不是一次归档整个目录,成功地创建了一个映像。但是,生成的映像只是基本的Ubuntu映像,而不是Dockerfile中指定的映像。我已复制了问题中的Dockerfile。请查看此问题以了解我如何解决此问题:我已通过将文件逐个添加到tar存档中来创建映像,而不是一次性存档整个目录。但是,生成的映像只是基本的Ubuntu映像,而不是Dockerfile中指定的映像。我已复制了问题中的Dockerfile。有关我如何解决此问题,请参见此问题:
var parameters = new BuildImageFromDockerfileParameters
{
RepositoryTagName = "test-image",
RemoveIntermediateContainers = true
};
using (var fileStream = new FileStream(@"C:\temp\Dockerfile.tar.gz",FileMode.Open))
{
await client.Miscellaneous.BuildImageFromDockerfileAsync(fileStream, parameters, new CancellationToken());
}
#using ubuntu as having trouble with ssl on debian
FROM ubuntu:14.04
#install php
RUN apt-get update && apt-get install -y php5-cli
#copy crontab, php script and data files container
COPY my-crontab /
COPY getData.php /
COPY saveddata.xml /
#run crontab
RUN crontab /my-crontab
ENTRYPOINT cron -f