Create base docker centos image with python 2.7.8 -


i've found this walks through creating base bare-metal centos image. want install additional yum packages, download python 2.7.8 , build it.

i had in dockerfile , working like:

# set base image ubuntu centos:7  # file author / maintainer maintainer sam mohamed  # update sources list run yum -y update run yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel xz-libs gcc g++ build-essential make  # install python 2.7.8 run curl -o /root/python-2.7.9.tar.xz  https://www.python.org/ftp/python/2.7.9/python-2.7.9.tar.xz run tar -xf /root/python-2.7.9.tar.xz -c /root run cd /root/python-2.7.9 && ./configure --prefix=/usr/local && make && make altinstall  # copy application folder inside container add `pwd` /opt/iws_project  # download setuptools , install pip , virtualenv run wget https://bootstrap.pypa.io/ez_setup.py -o - | /usr/local/bin/python2.7 run /usr/local/bin/easy_install-2.7 pip run /usr/local/bin/pip2.7 install virtualenv  # create virtualenv , install requirements: run /usr/local/bin/virtualenv /opt/iws_project/venv && source /opt/iws_project/bin/activate && pip install -r /opt/iws_project/requirements.txt 

how can convert above base image?

you better off building given dockerfile , using resulting image base future images. easier maintain , doesn't cost in terms of resource use.

but if want create single-layer "base image", steps follows:

  1. install want directory (docker-centos-65/ in linked tutorial).

    • you can modify febootstrap command tutorial linked install additional yum packages specifying more -i flags.
    • you can perform other custom installs (e.g. python) manually, make sure ends in same root directory
  2. create tar archive of directory installed, , pipe docker import command:

    tar c -c docker-centos-65/ . | docker import - my-base-image 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -