修改在Docker镜像中使用pip安装的python文件
我在docker中使用RUN pip install requests-aws4auth
安装了一个名为requests-aws4auth的python模块
现在我想通过进入cd /opt/conda/lib/python2.7/site-packages/requests_aws4auth/
并注释aws4auth.py
文件中的一行来修改它。 在构builddocker的时候,我已经安装了vim。
在构builddockerfile的时候可以这样做吗? 如果是,那么有人可以帮我一把。
我可以通过使用sudo docker run -i -t image_name /bin/bash
并修改文件来实现,但是这会创build一个容器。 现在,有没有办法将容器推回到图像上。
有两种方法可以做到这一点:
-
在pfile
pip install
命令后,在dockerfile中添加一些在文件中注释行的sed命令 –RUN pip install requests-aws4auth RUN sed -e '/BBB/ s/^#*/#/' -i file #some logic to comment the line
构buildDocker镜像并使用它。 -
如果选项1似乎没有帮助尝试提交容器。
docker run
容器做docker exec
和评论文件中的行。 现在提交容器docker commit <conatainer-id> <some custom image name>
https://docs.docker.com/engine/reference/commandline/commit/现在使用这个自定义图像。
- 在Elastic Beanstalk上挂载Docker nfs4
- 我如何才能获得与AWS / Debian合作的cadvisor(Docker)?
- Amazon ECR上的受限映像提取权限
- 如何向AWS ECS任务定义提供环境variables?
- 可以在AWS Elastic Beanstalk的Docker中设置–insecure-registry属性
- Amazon应用程序负载均衡器基于主机的路由到特定的ECS容器服务
- 在Elastic Beanstalk上设置Docker容器主机名
- curl -LI不输出Elastic Beanstalk应用程序
- mongodb replica set master“stateStr”:“REMOVED”