I have a central Dockerfile
. It's locate in ~/base/Dockerfile
.
Let's say it only builds a simple debian
image.
FROM debian
COPY test.js .
I also have a central docker-compose.yml
file that uses this Dockerfile
.
It is located in ~/base/docker-compose.yml
.
version: "3.9"
services:
test:
build: ~/base/Dockerfile
ports:
- "5000:5000"
I also have a bash file that calls this docker-compose.yml
from another directory.
For example:
mkdir temp
cd temp
setup
setup
is a bash file that is registered in the /etc/bash.bashrc
as a global alias.
It contains these lines:
docker-compose -f ~/base/docker-compose.yml build
docker-compose up -d
docker-compose logs --f test
I can run setup
from inside any folder, and it should build a container based on that debian
image. And it does.
However, it shows me that the name of the container is base_test_1
, which is the default convention of docker.
This shows that it uses ~/base/.
as the context.
How can I pass my current directory as the context?