How can I extend unregistered docker images or dockerfiles?

Or maybe instead of using FROM there is a way to inject the contents of another dockerfile into the start of my own.

  • PHP websites with Docker
  • Link & Expose Docker Container Simultaniously
  • Running docker on Ubuntu: mounted host volume is not writable from container
  • How to run install pip requirements from private repo in google cloud source?
  • Amazon AWS ECS Task delay
  • How to list images in docker registry being on registry server?
  • Should we install a docker image from Docker Hub at the begining?
  • Docker Mount Volume Directory with Install Files
  • Docker container port issue
  • How can let docker use my network router to assign dhcp ip to containers easily instead of pipework?
  • How to edit files in container docker by editor
  • docker swarm init on windows container output nothing
  • One Solution collect form web for “How can I extend unregistered docker images or dockerfiles?”

    In any case you will need a base Operating System image to source from and then you can use the content of the “other” Dockerfile you want to use and append your own command and form a complete file.

    For example the below line will just include the base OS layer:

    FROM ubuntu

    MAINTAINER Prasanjit Singh

    And then add stuff from the borrowed docker file, say the below lines:

    ENV USER root ENV PASS aiPeekai0AeZ2meephoolais7doo1thu

    RUN \ apt-get update && \ apt-get -y install \
    mysql-server-5.5 && \ rm -rf /var/lib/apt/lists/*

    COPY my.cnf /etc/mysql/my.cnf COPY start.sh start.sh

    VOLUME [“/var/lib/mysql”]

    RUN rm /usr/sbin/policy-rc.d CMD [“/start.sh”]

    EXPOSE 3306

    And finally add your append your own(if any) and the file looks like this now:

    FROM ubuntu
    MAINTAINER Prasanjit Singh
    
    ENV USER root
    ENV PASS aiPeekai0AeZ2meephoolais7doo1thu
    
    RUN \
      apt-get update && \
      apt-get -y install \
              mysql-server-5.5 && \
      rm -rf /var/lib/apt/lists/*
    
    COPY my.cnf /etc/mysql/my.cnf
    COPY start.sh start.sh
    
    VOLUME ["/var/lib/mysql"]
    
    RUN rm /usr/sbin/policy-rc.d
    RUN rm /your/shell/script_or_command.sh # Add your stuff
    CMD ["/start.sh"]
    
    EXPOSE 3306
    

    And you are done with the Dockerfile. Just build it and get your container launched. Let me know if it you need anything.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.