Docker Community Forums

Share and learn in the Docker community.

How can I create TWO CentOS 7 Image that contains diffrent contents

Hi I have a question

I want to create 2 containers based on CentOS 7 Image with docker-compose
But when I create second container , the second container contains first container’s dockerfile info [RUN mkdir -p /apps/software ] that is not described second container’s dockerfile

I want to create images independently based on CentOS 7 Image
and want to link each container.

How Can solve this problem?? I need Help!!

The below is my docker-compose.yml and diagram

Thanks!!

version : “2”

networks:
frontend:
ipam:
config:
- subnet: 10.6.0.0/16

services:
tomcat:
image: centos:7
build:
context : .
args:
warpath: SampleWebApp.war
dockerfile : file/Dockerfile_tomcat/.
container_name: tomcat
ports:
- 8080:8080
links:
- cache
networks:
frontend:
ipv4_address : 10.6.0.5

    cache:
            image: centos:7
            build:
                    context : .
                    dockerfile : file/Dockerfile_cache/.
            container_name: cache
            ports:
                     - 5701:5701
            networks:
                    frontend:
                            ipv4_address : 10.6.0.6

docker-compose