简体   繁体   中英

building docker image from dockerfile

Here is my command in terminal to build image, sudo docker build -t actinbox3.2:latest .

I'm getting this error

" Step 0 : FROM iamdenmarkcontrevida/base
        Pulling repository iamdenmarkcontrevida/base
        INFO[0020] Repository not found"

Dockerfile

    # Dockerfile for base image of actInbox
    FROM iamdenmarkcontrevida/base

    MAINTAINER Denmark Contrevida<DMcontrevida@gmail.com>


    # Config files
    COPY config /actinbox_config/
    COPY script /actinbox_script/
    COPY database /actinbox_db/

    # Config pyenv
    RUN echo 'export PYENV_ROOT="/root/.pyenv"' >> /root/.bashrc && \
        echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.bashrc && \
        echo 'eval "$(pyenv init -)"' >> /root/.bashrc && \
    # Config Nginx
        rm /etc/nginx/sites-enabled/default && \
        ln -s /actinbox_config/actinbox.conf /etc/nginx/sites-enabled/actinbox.conf && \
    # Config PostgreSQL
        rm /etc/postgresql/9.3/main/pg_hba.conf && \
        ln -s /actinbox_config/pg_hba.conf /etc/postgresql/9.3/main/pg_hba.conf && \
    # Create DB & Restore database
        sh /actinbox_config/create_db_actinbox.sh && \
    # Delete template folder
        rm -r /actinbox_db/

Mydockerfile in Base

Dockerfile for base image of actInbox

    FROM ubuntu:14.04

    MAINTAINER Denmark Contrevida<DMcontrevida@gmail.com> 

    # Base services
    RUN apt-get update && apt-get install -y \
        git nginx postgresql postgresql-contrib

    # Install Pyenv, Python 3.x, django, uWSGI & psycopg2
    COPY config/install_pyenv.sh /tmp/install_pyenv.sh
    RUN sh /tmp/install_pyenv.sh

Please help me out or any idea why im getting this error? I have an account in docker hub...........

Thank you in advance!

Basically, it can't find the iamdenmarkcontrevida/base image in dockerhub.

Did you build/push the base image?

docker build .
docker tag <local-image-id> iamdenmarkcontrevida/base:latest
docker push iamdenmarkcontrevida/base

No need push, if you only need run it locally.

So you need build the base image first, then build actinbox3.2

For example (suppose you have different Dockerfile name)

sudo docker build -t iamdenmarkcontrevida/base -f Dockerfile.base
sudo docker build -t actinbox3.2 -f Docker.actinbox3.2

tag latest is default, so no need add it in build command.

You can try packer framework
that is easiest way to create docker image. it also supported many other type of machine image.

https://www.packer.io/docs/builders/index.html

It's just a two line command -

  1. Get your local-image-id
docker ps
  1. Copy Names
docker build -t local-image-id/Any name you want:latest . 

For me docker build -t condescending_greider/newdoc:latest .

Thanks for your time :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM