从dockerfile建立docker图像

问题描述 投票:4回答:3

这是我在终端建立图像的命令,sudo docker build -t actinbox3.2:latest

我收到了这个错误

" 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<[email protected]>


    # 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/

Base中的Mydockerfile

Dockerfile for base image of actInbox

    FROM ubuntu:14.04

    MAINTAINER Denmark Contrevida<[email protected]> 

    # 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

请帮帮我或任何想法为什么我得到这个错误?我在码头中心有一个账号...........

先感谢您!

docker
3个回答
3
投票

基本上,它无法在dockerhub中找到iamdenmarkcontrevida/base图像。

你建立/推动基本图像了吗?

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

0
投票

如果你只需要在本地运行它,就不需要推送。

所以你需要先构建基本图像,然后构建actinbox3.2

例如(假设您有不同的Dockerfile名称)

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

标签latest是默认值,因此不需要在build命令中添加它。


0
投票

你可以尝试打包机框架 这是创建docker镜像的最简单方法。它还支持许多其他类型的机器图像。

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

© www.soinside.com 2019 - 2024. All rights reserved.