I am using docker-compose to start 2 containers using the following docker-compose.yaml.
version: '2.4'
services:
myservice1:
container_name: mycontainername
build:
context: .
dockerfile: ./my-dockerfolder/Dockerfile
args:
- MY_ARG=${MY_ARG}
environment:
- MY_ARG=${MY_ARG}
mem_limit: 3500M
ports:
- "9090:9090"
extra_hosts:
- "one.mydomain.net:127.0.0.1"
- "two.mydomain.net:127.0.0.1"
myservice2:
container_name: myothercontainername
build:
context: .
dockerfile: ./other-dockerfolder/Dockerfile
args:
- BUILD=${BUILD}
- MY_ARG=${MY_ARG2}
environment:
- MY_ARG2=${MY_ARG2}
ports:
- "2023:22"
My problem is that when I run docker-compose up again, it is using the same image to create the container, regardless of changes to the docker file.
How can I force it to take changes to the docker file into account?
Are other docker objects being reused that I need to be worried about? I want the second time I run docker-compose up to be as clean an environment as the first time.
note: I do not want to delete images that I do not need to delete. I have a slow connection to the docker repo, and removeing all the images would make my docker compose up take ~22 minutes.