[英]How do I upgrade to Python3+ in my Docker Compose Container
I have a simple docker compose file which is just Jenkins and MongoDB.我有一个简单的 docker 组合文件,它只是 Jenkins 和 MongoDB。
version: '3.7'
services:
jenkins:
image: jenkins/jenkins:lts
privileged: true
user: root
ports:
- 8081:8080
- 50000:50000
container_name: jenkins
volumes:
- ./Docker/FS/jenkins:/var/jenkins_home
- ./Docker/FS/var/run/docker.sock:/var/run/docker.sock
- ./Docker/FS/usr/local/bin/docker:/usr/local/bin/docker
- ../Data:/var/DataHome
mongodb:
image: 'mongo'
container_name: 'mongodb_container'
volumes:
- ./Docker/FS/MongoDB:/data/db
ports:
- '27017-27019:27017-27019'
When trying to run a command in jenkins, I noticed that it is running Python 2.7, which isn't ideal.当尝试在 jenkins 中运行命令时,我注意到它正在运行 Python 2.7,这并不理想。
Is there a simple way to upgrade that to python3+?有没有一种简单的方法可以将其升级到 python3+?
Do I have to create a new image to do this?我是否必须创建一个新图像才能做到这一点? Can you combine multiple images?可以合并多张图片吗?
You can create a new image with a Dockerfile您可以使用 Dockerfile 创建新图像
FROM jenkins/jenkins:latest
RUN <cmd to remove python2> && <cmd to install python3>
CMD <cmd to launch your main process>
I make the assumption that changing python version does not impact jenkins at all.我假设更改 python 版本根本不会影响 jenkins。 It might not be the case.情况可能并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.