I'm using docker-compose to create my development environment. I want to build a specific image, but I don't know how to set a name for that image.
wildfly:
build: /path/to/dir/Dockerfile
container_name: wildfly_server
ports:
- 9990:9990
- 80:8080
environment:
- MYSQL_HOST=mysql_server
- MONGO_HOST=mongo_server
- ELASTIC_HOST=elasticsearch_server
volumes:
- /Volumes/CaseSensitive/development/wildfly/deployments/:/opt/jboss/wildfly/standalone/deployments/
links:
- mysql:mysql_server
- mongo:mongo_server
- elasticsearch:elasticsearch_server
When I execute docker-compose
everything is ok, but I get a random name for the new image. Is it possible to set a name to the build image?
<project>_<service>
, where<service>
in this example iswildfly
and project defaults to the directory name you're in. You can change that with-p
orCOMPOSE_PROJECT_NAME
environment variable. There is no way to set a custom image name. – ChloralCOMPOSE_PROJECT_NAME=x
in.env
and your containers will be called{x}_{service}_{#}
– Fecund