Comment installer python3 avec docker centos

introduction

Cet article utilise Amazon Linux 2 d'AWS pour effectuer les opérations suivantes:

  1. Installez docker
  2. Démarrez centos, qui est une image docker
  3. Installez python3 dans le conteneur démarré en 2.

1. Installez docker

Tout d'abord, mettez à jour yum comme suit.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo yum update -y

Ensuite, installez docker.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo amazon-linux-extras install docker -y

Une fois l'installation terminée, démarrez le démon docker.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo service docker start

Ajoutez ec2-user au groupe docker. Ce n'est pas obligatoire, mais vous pouvez ensuite utiliser la commande docker sans `` sudo.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo usermod -a -G docker ec2-user

Après avoir exécuté la commande ci-dessus, fermez le terminal une fois. Puis reconnectez-vous.

2. Démarrer centos

Tout d'abord, démarrez le conteneur avec la commande run ''. Si l'image n'a pas été extraite, vous pouvez la tirer avant de la lancer. L'option -it '' vous permet d'entrer dans le conteneur lancé. (... s'écrit en omettant le message affiché)

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ docker run -it centos
・
・
・
[root@xxx /]#

3. Installez python3 dans le conteneur

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ yum install python3 -y

En entrant la commande `` python3 '' comme indiqué ci-dessous, vous pouvez entrer en mode interactif et savoir qu'il a été installé.

[root@xxx /]# python3
Python 3.6.8 (default, Apr 16 2020, 01:36:27)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Après l'installation, vous pouvez utiliser la commande pip3``` pour installer les packages requis. J'ai installé aws-cli version 1 avec la commande suivante:

[root@xxx /]# pip3 install awscli

Article de référence

--Site officiel de l'AWS https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/docker-basics.html --Installez pip et awscli sur CentOS7 https://rriifftt.hatenablog.com/entry/2015/10/28/142043

Recommended Posts

Comment installer python3 avec docker centos
Comment installer Python
Comment installer Python [Windows]
Comment installer Python à l'aide d'Anaconda
Comment installer python-pip avec ubuntu20.04LTS
Comment installer PyPy sur CentOS
Comment démarrer avec Python
Comment installer TensorFlow sur CentOS 7
Comment calculer la date avec python
Comment installer mysql-connector avec pip3
Comment installer Maven sur CentOS
Comment installer Anaconda avec pyenv
CentOS8 --Installer --Python3
Comment installer NPI + envoyer un message à la ligne avec python
Comment installer et utiliser pandas_datareader [Python]
python3 Comment installer un module externe
[Kivy] Comment installer Kivy sur Windows [Python]
Comment installer DLIB avec 2020 / CUDA activé
Connectez-vous à MySQL avec Python dans Docker
Comment utiliser BigQuery en Python
Comment afficher le japonais python avec lolipop
Comment installer Eclipse GlassFish 5.1.0 sur CentOS7
Comment installer Apache (httpd) sur CentOS8
Comment installer zsh (avec la personnalisation .zshrc)
Comment installer pip
Comment installer Archlinux
Installez Python3.4 sur CentOS 6.6
Comment installer BayesOpt
Installez Voluptuous avec Python 2.5
Utiliser python avec docker
Introduction de Python 2.7 à CentOS 6.6
Installez Python avec pyenv
Comment installer Nbextensions
Comment télécharger avec Heroku, Flask, Python, Git (4)
Comment profiter de la programmation avec Minecraft (Ruby, Python)
[REAPER] Comment jouer à Reascript avec Python
Comment faire un traitement parallèle multicœur avec python
[Version 2020] Comment installer Python3 sur EC2 d'AWS
Comment supprimer le journal avec Docker, ne pas collecter le journal
Comment recadrer une image avec Python + OpenCV
Comment installer Python pour les chercheurs de sociétés pharmaceutiques
Comment installer OpenGM sur OSX avec macports
Comment mesurer le temps d'exécution avec Python Partie 1
Comment utiliser tkinter avec python dans pyenv
[Python] Comment comparer la date / heure avec le fuseau horaire ajouté
[CentOS8] Comment afficher la sortie Python standard dans le journal systemd
Comment mesurer le temps d'exécution avec Python, partie 2
Connectez-vous à BigQuery avec Python
Comment convertir / restaurer une chaîne avec [] en python
python3: Comment utiliser la bouteille (2)
Installer l'environnement Python avec Anaconda
Comment récupérer des données d'image de Flickr avec Python
Comment faire un calcul de hachage avec Salt en Python
[Introduction à Python] Comment itérer avec la fonction range?
Comment installer Tabpy 1.0 (version 2020-01)
Connectez-vous à Wikipedia avec Python
Comment mettre à jour Tkinter de Python vers la version 8.6
Publiez sur Slack avec Python 3