Reputation: 5878
I am working in a local docker image that I created.
Now I am using docker-compose to send more parameters.
version: '2'
services:
helloworld:
image: helloworld:1.0
environment:
ports:
- "8002:8002"
so, according the docker documentation https://docs.docker.com/compose/compose-file/compose-file-v2/#ports is the right way to do it
But everytime I try to run it I get that
services.helloworld.enviroment.ports contains ["8002"], which is an invalid type, it should be a string, number, or a null
I have tried removing the quotes, the - , different spaces and all have same results :s should be very simple but cannot figure it out, any idea?
Upvotes: 0
Views: 67
Reputation: 264791
Yaml files are white space sensitive. With your indentation, you've placed the ports within an environment section where it doesn't belong. Instead you need it within your service:
version: '2'
services:
helloworld:
image: helloworld:1.0
ports:
- "8002:8002"
Upvotes: 2