Is there a way to combine Docker images into 1 container?

前端 未结 7 641
旧时难觅i
旧时难觅i 2020-12-04 14:29

I have a few Dockerfiles right now.

One is for Cassandra 3.5, and it is FROM cassandra:3.5

I also have a Dockerfile for Kafka, but t is quite a

7条回答
  •  北海茫月
    2020-12-04 14:46

    I needed docker:latest and python:latest images for Gitlab CI. Here is what I came up with:

    FROM ubuntu:latest
    RUN apt update
    RUN apt install -y sudo
    RUN sudo apt install -y docker.io
    RUN sudo apt install -y python3-pip
    RUN sudo apt install -y python3
    RUN docker --version
    RUN pip3 --version
    RUN python3 --version
    

    After I've build and pushed it to my Docker Hub repo:

    docker build -t docker-hub-repo/image-name:latest path/to/Dockerfile
    docker push docker-hub-repo/image-name:latest
    

    Don't forget to docker login before push

    Hope it helps

提交回复
热议问题