Combat réel: utilisez Docker pour configurer l'environnement du robot scrapy sous ubuntu

1 Préparez le conteneur Docker

1.1 Installer DockerToolBox

Référence:
http://www.oschina.net/translate/installing-docker-on-mac-os-x
https://github.com/boot2docker/osx-installer/releases

1.2 Configurer le miroir ubuntu

$ docker pull daocloud.io/ubuntu:14.04

1.3 Démarrez l'image docker et entrez ubuntu14.04

$ docker run -it ubuntu: 14.04

2 Installation dans un conteneur docker

2.1 Mettre à jour apt-get

  # apt-get mise à jour

2.2 Installer python2.7.6

  #sudo apt-get installer python

2.3 Installez wget, l'outil pour télécharger des fichiers sous la ligne de commande

  # apt-get install wget

2.4 Entrez dans le répertoire temporaire pour télécharger les fichiers nécessaires à l'installation

  #cd tmp

2.5 Téléchargez et installez pip

#wget https://bootstrap.pypa.io/get-pip.py 
 #python get-pip.py

—————- extrémité de base —————–

2.6 Installer make

 # apt-get install make

2.7 Installer g ++

# apt-get install build-depgcc 
 # apt-get install build-essential

——— gcc end ————

2.8 Dépendances d'installation

# apt-get install libxml2-dev libxslt1-dev 
 # apt-get install libgsl0-dev 
 # apt-get install python-dev 
 # apt-get install libffi-dev 
 # apt-get install libssl-dev

——— dep end ————

2.9 installer scrapy

 #pip installer scrapy

3 Comment enregistrer les modifications

3.1 Quitter le dockerTerminal

 #sortir

3.2 Voir containerId

$ docker ps -a -q 
cc4072aadb13

3.3 Enregistrer l'image

$ docker commit cc40 ubuntu / spider 
02db509cb269710f8f80b2a35f12995c59c668b3e3ba2e7148987bc55d713fa5

3.4 Afficher l'image qui vient d'être enregistrée

$ docker images 
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 
ubuntu / spider dernière 138b6860da02 Il y a environ une minute 228,2 Mo 
ubuntu dernière 6cc0fc2a5ee3 il y a 3 jours 187,9 Mo 
ubuntu 14,04 6cc0fc2a5ee3 il y a 3 jours 187,9 MB 
honeydeiMfac: ~

3.5 Vous pouvez utiliser la commande suivante pour accéder à l'environnement précédemment installé

 $ docker run -it ubuntu / spider

Je suppose que tu aimes

Origine blog.csdn.net/windcao/article/details/50575145
conseillé
Classement