Skip to main content

iI have a classic javaJava webapp. its It is composed of a database (postgresqlPostgreSQL), a servlet container (tomcatTomcat) and my code (deployed on tomcatTomcat as a *.war file).

iI want to package/deploy it using dockerDocker (mostly for testing for now), but imI'm unsure what would be the best way to "map" it.

myMy initial idea was to have an app-in-a-box - define a container that has javaJava, postgresPostgres and tomcatTomcat on it, exposing just the http port.

furtherFurther reading of the dockerDocker docs shows that this, although possible (install and run supervisord as the single foreground process, have it start both postgresPostgres and tomcatTomcat) is probably not the intended usage. going Going by the spirit of the tutorials iI should probably create a container for postgresPostgres, another for tomcatTomcat, and a data-container to hold the application code (my *.war) and database files. this This would mean 3+ containers (should the db files and *.war share the same data container?)

whatsWhat's the common practice here?

since iSince I have no previous experience with dockerDocker, what pitfalls can iI expect from each approach?

isIs there some other approach imI'm missing?

i have a classic java webapp. its composed of a database (postgresql), a servlet container (tomcat) and my code (deployed on tomcat as a *.war file).

i want to package/deploy it using docker (mostly for testing for now), but im unsure what would be the best way to "map" it.

my initial idea was to have an app-in-a-box - define a container that has java, postgres and tomcat on it, exposing just the http port.

further reading of the docker docs shows that this, although possible (install and run supervisord as the single foreground process, have it start both postgres and tomcat) is probably not the intended usage. going by the spirit of the tutorials i should probably create a container for postgres, another for tomcat, and a data-container to hold the application code (my *.war) and database files. this would mean 3+ containers (should the db files and *.war share the same data container?)

whats the common practice here?

since i have no previous experience with docker, what pitfalls can i expect from each approach?

is there some other approach im missing?

I have a classic Java webapp. It is composed of a database (PostgreSQL), a servlet container (Tomcat) and my code (deployed on Tomcat as a *.war file).

I want to package/deploy it using Docker (mostly for testing for now), but I'm unsure what would be the best way to "map" it.

My initial idea was to have an app-in-a-box - define a container that has Java, Postgres and Tomcat on it, exposing just the http port.

Further reading of the Docker docs shows that this, although possible (install and run supervisord as the single foreground process, have it start both Postgres and Tomcat) is probably not the intended usage. Going by the spirit of the tutorials I should probably create a container for Postgres, another for Tomcat, and a data-container to hold the application code (my *.war) and database files. This would mean 3+ containers (should the db files and *.war share the same data container?)

What's the common practice here?

Since I have no previous experience with Docker, what pitfalls can I expect from each approach?

Is there some other approach I'm missing?

Source Link
radai
  • 213
  • 2
  • 10

docker-izing a classical db-based webapp - single or multiple containers?

i have a classic java webapp. its composed of a database (postgresql), a servlet container (tomcat) and my code (deployed on tomcat as a *.war file).

i want to package/deploy it using docker (mostly for testing for now), but im unsure what would be the best way to "map" it.

my initial idea was to have an app-in-a-box - define a container that has java, postgres and tomcat on it, exposing just the http port.

further reading of the docker docs shows that this, although possible (install and run supervisord as the single foreground process, have it start both postgres and tomcat) is probably not the intended usage. going by the spirit of the tutorials i should probably create a container for postgres, another for tomcat, and a data-container to hold the application code (my *.war) and database files. this would mean 3+ containers (should the db files and *.war share the same data container?)

whats the common practice here?

since i have no previous experience with docker, what pitfalls can i expect from each approach?

is there some other approach im missing?