Actual combat: Use Docker to configure the scrapy crawler environment under ubuntu

1 Prepare the docker container

1.1 Install DockerToolBox

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

1.2 Configure ubuntu mirror

$docker pull daocloud.io/ubuntu:14.04

1.3 Start the docker image and enter ubuntu14.04

$docker run -it ubuntu:14.04

2 Installation in docker container

2.1 Update apt-get

  #apt-get update

2.2 Install python2.7.6

  #sudo apt-get install python

2.3 Install wget, the tool to download files under the command line

  #apt-get install wget

2.4 Enter the temporary directory to download the files needed for installation

  #cd tmp

2.5 Download and install pip

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

—————- base end —————–

2.6 Install make

 #apt-get install make

2.7 Install g++

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

——— gcc end ————

2.8 Installation dependencies

 #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 install scrapy

 #pip install scrapy

3 How to save changes

3.1 Exit dockerTerminal

 #exit

3.2 View containerId

$docker ps -a -q
cc4072aadb13

3.3 Save the image

$ docker commit cc40 ubuntu/spider
02db509cb269710f8f80b2a35f12995c59c668b3e3ba2e7148987bc55d713fa5

3.4 View the image just saved

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
ubuntu/spider       latest              138b6860da02        About a minute ago   228.2 MB
ubuntu              latest              6cc0fc2a5ee3        3 days ago           187.9 MB
ubuntu              14.04               6cc0fc2a5ee3        3 days ago           187.9 MB
honeydeiMac:~ caojianfeng$ 

3.5 You can use the following command to enter the previously installed environment

 $docker run -it ubuntu/spider

Guess you like

Origin blog.csdn.net/windcao/article/details/50575145