A Java EE container is defined as:
"Containers are the interface between a component and the low-level platform-specific functionality that supports the component."and further
"Before a web, enterprise bean, or application client component can be executed, it must be assembled into a Java EE module and deployed into its container.[https://docs.oracle.com/javaee/5/tutorial/doc/bnabo.html]
The assembly process involves specifying container settings for each component in the Java EE application and for the Java EE application itself. Container settings customize the underlying support provided by the Java EE server, including services such as security, transaction management, Java Naming and Directory Interface (JNDI) lookups, and remote connectivity. (...)"
According to the definition above, a container is the realization of separation of concerns between business logic and infrastructural functionality like: concurrency, state management, transactions, monitoring, dependency injection / inversion of control, aspects, throttling, resource pooling (connections, queues) etc.
Without container concepts the business logic and generic infrastructure would be intermingled.
More interesting is the question whether a component has to be deployed into a container, or whether the container is embedded into the application. Although this question remains interesting, it looses its importance with the increasing popularity Rkt or docker.
With e.g. docker, you are deploying a single archive regardless of its contents. Docker needs an executable start script which could point to either a fully fledged application server or an executable Java archive which launches the application server (or a container-less framework which acts like an application server, but is named differently).
NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards