我已在我的docker文件中添加了git clone。图像构建成功

问题描述 投票:-1回答:1

但无法在映像中找到我的克隆源代码。在本地计算机上,克隆工作正常,但对于docker conatiner而言却不是。运行git clone https://h..../public.git

成功建立的图像ID

FROM ubuntu

维护者卢克·克鲁克斯“ [email protected]

运行apt-get更新

运行apt-get install -y apache2 && apt-get clean

运行apt-get install -y git

运行mkdir /root/.ssh /

运行touch /root/.ssh/id_rsa

EXPOSE 8080 / tcp

运行touch /root/.ssh/known_hosts

运行ssh-keyscan -T 60 bitbucket.org >> /root/.ssh/known_hosts

运行git clone -b newbr https://[email protected]/haseeb/public.git

WORKDIR / var / lib / docker / overlay2 / work

docker dockerfile clone docker-image
1个回答
0
投票

尝试像下面的代码片段一样更新docker文件并重新构建

FROM ubuntu

MAINTAINER Luke Crooks "[email protected]"

RUN apt-get update

RUN apt-get install -y apache2 && apt-get clean

RUN apt-get install -y git

RUN mkdir /root/.ssh/

RUN touch /root/.ssh/id_rsa

EXPOSE 8080/tcp

RUN touch /root/.ssh/known_hosts

RUN ssh-keyscan -T 60 bitbucket.org >> /root/.ssh/known_hosts

RUN makdir -p /var/lib/docker/overlay2/work
WORKDIR /var/lib/docker/overlay2/work
RUN git clone -b newbr https://[email protected]/haseeb/public.git

克隆的仓库应该在/var/lib/docker/overlay2/work中>

© www.soinside.com 2019 - 2024. All rights reserved.