version: “3.9”
services:
apache:
image: httpd:latest
container_name: httpd
ports:
- ‘6100:80’
volumes:
- /usr/local/apache2/htdocs:/opt/itadmin
You got your volume map the wrong way around, it goes host:container
.
Try running as root
:
sudo docker-compose up
Please post your docker-compose.yaml
file as text here in a code block </>
version: ‘2’
services:
web:
build: ./app
container_name: python
ports:
- “5000:5000”
volumes:
- ./app:/code
depends_on:
- redis
redis:
image: redis
container_name: redis
Can you put it inside a text block please - it is the ‘`</>’ icon on the menu bar. Text should look like this:
I'm the first line of a text block
- I am indented
I am indented more:
version: ‘2’
services:
web:
build: ./app
container_name: python
ports:
“5000:5000”
volumes:
./app:/code
depends_on:
redis
redis:
image: redis
container_name: redis
The formatting is off. Copy and paste it exactly as it is mean to be.
that’s what i did let me try again
version: ‘2’
services:
web:
build: ./app
container_name: python
ports:
- “5000:5000”
volumes:
- ./app:/code
depends_on:
- redis
redis:
image: redis
container_name: redis
That is not a valid docker-compose file.
what am i doing wrong here ?
Your docker-compose file has no indenting. Look at your post after you submit it.
version: '2'
services:
web:
image: .
container_name: python
ports:
- "5000:5000"
volumes:
- .:/code
depends_on:
- redis_app
redis_app:
image: redis
container_name: redis
Sir I am bit confused this is my actual docker compose file. what do you mean by it does not have any indenting ?
this is the error I am getting.
The latest post of you YAML does have indenting, it didn’t before. That is what I mean.
The error you are getting is that compose is not a command for docker. You should run:
docker-compose up
What does image: .
mean?
version: '2'
services:
web:
build: .
container_name: python
ports:
- "5000:5000"
volumes:
- .:/code
depends_on:
- redis_app
redis_app:
image: redis
container_name: redis