Step 1: Open terminal and execute the command
‘docker run jboss/wildfly’
$docker run jboss/wildfly Unable to find image 'jboss/wildfly:latest' locally latest: Pulling from jboss/wildfly a02a4930cb5d: Pull complete b5ffff9dbcda: Pull complete 36845d6d0218: Pull complete 08619c8c88e2: Pull complete 6292a0d81fc0: Pull complete Digest: sha256:d538754ee178cd3f8e954d9e093e81ce5b0dfa0ef56919fcab50c1f932ee594e Status: Downloaded newer image for jboss/wildfly:latest ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /opt/jboss/wildfly JAVA: /usr/lib/jvm/java/bin/java JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED --add-modules=java.se ========================================================================= 08:03:38,511 INFO [org.jboss.modules] (main) JBoss Modules version 1.9.0.Final 08:03:39,310 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.5.Final 08:03:39,327 INFO [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final 08:03:39,578 INFO [org.jboss.as] (MSC service thread 1-3) WFLYSRV0049: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) starting 08:03:41,098 INFO [org.wildfly.security] (ServerService Thread Pool -- 27) ELY00001: WildFly Elytron version 1.8.0.Final 08:03:42,231 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation. 08:03:42,288 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 28) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation. 08:03:42,421 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http) 08:03:42,462 INFO [org.xnio] (MSC service thread 1-7) XNIO version 3.6.5.Final 08:03:42,488 INFO [org.xnio.nio] (MSC service thread 1-7) XNIO NIO Implementation Version 3.6.5.Final 08:03:42,585 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 70) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique. 08:03:42,573 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 62) WFLYNAM0001: Activating Naming Subsystem 08:03:42,600 INFO [org.wildfly.extension.microprofile.opentracing] (ServerService Thread Pool -- 61) WFLYTRACEXT0001: Activating MicroProfile OpenTracing Subsystem 08:03:42,642 INFO [org.jboss.as.connector] (MSC service thread 1-3) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.12.Final) 08:03:42,645 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 49) WFLYCLINF0001: Activating Infinispan subsystem. 08:03:42,648 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 72) WFLYWS0002: Activating WebServices Extension 08:03:42,648 INFO [org.jboss.as.security] (ServerService Thread Pool -- 68) WFLYSEC0002: Activating Security Subsystem 08:03:42,654 INFO [org.wildfly.extension.microprofile.config.smallrye._private] (ServerService Thread Pool -- 58) WFLYCONF0001: Activating WildFly MicroProfile Config Subsystem 08:03:42,635 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 51) WFLYRS0016: RESTEasy version 3.6.3.Final 08:03:42,662 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 56) WFLYJSF0007: Activated the following JSF Implementations: [main] 08:03:42,660 INFO [org.wildfly.extension.microprofile.metrics.smallrye] (ServerService Thread Pool -- 60) WFLYMETRICS0001: Activating Eclipse MicroProfile Metrics Subsystem 08:03:42,713 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0003: Undertow 2.0.19.Final starting 08:03:42,720 INFO [org.wildfly.extension.microprofile.health.smallrye] (ServerService Thread Pool -- 59) WFLYHEALTH0001: Activating Eclipse MicroProfile Health Subsystem 08:03:42,703 INFO [org.jboss.as.security] (MSC service thread 1-4) WFLYSEC0001: Current PicketBox version=5.0.3.Final 08:03:42,778 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 50) WFLYIO001: Worker 'default' has auto-configured to 12 core threads with 96 task threads based on your 6 available processors 08:03:42,809 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 42) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4) 08:03:42,824 INFO [org.jboss.as.mail.extension] (MSC service thread 1-3) WFLYMAIL0002: Unbound mail session [java:jboss/mail/Default] 08:03:42,836 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Started Driver service with driver-name = h2 08:03:42,837 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default] 08:03:42,848 INFO [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service 08:03:42,932 INFO [io.smallrye.metrics] (MSC service thread 1-5) Converted [2] config entries and added [4] replacements 08:03:42,939 INFO [io.smallrye.metrics] (MSC service thread 1-5) Converted [3] config entries and added [18] replacements 08:03:42,962 INFO [org.jboss.remoting] (MSC service thread 1-7) JBoss Remoting version 5.0.8.Final 08:03:43,129 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS] 08:03:43,247 INFO [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 24 (per class), which is derived from the number of CPUs on this host. 08:03:43,278 INFO [org.jboss.as.ejb3] (MSC service thread 1-4) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 96 (per class), which is derived from thread worker pool sizing. 08:03:43,362 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server. 08:03:43,355 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 71) WFLYUT0014: Creating file handler for path '/opt/jboss/wildfly/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]'] 08:03:43,383 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0018: Host default-host starting 08:03:43,613 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080 08:03:43,717 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0493: EJB subsystem suspension complete 08:03:43,832 INFO [org.jboss.as.patching] (MSC service thread 1-6) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none 08:03:43,862 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS] 08:03:43,888 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-7) WFLYDM0111: Keystore /opt/jboss/wildfly/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost 08:03:43,941 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments 08:03:44,040 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0006: Undertow HTTPS listener https listening on 0.0.0.0:8443 08:03:44,147 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBossWS 5.2.4.Final (Apache CXF 3.2.7) 08:03:44,281 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server 08:03:44,286 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management 08:03:44,286 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990 08:03:44,287 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 16.0.0.Final (WildFly Core 8.0.0.Final) started in 6442ms - Started 305 of 531 services (324 services are lazy, passive or on-demand)
Step 2: See all the running containers by
executing the command ‘docker container ls’.
$ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c9a1bfa89e1e jboss/wildfly "/opt/jboss/wildfly/…" 3 minutes ago Up 3 minutes 8080/tcp infallible_elgamal
Step 3: You can stop the container by
executing ‘docker container stop’ command.
Syntax
docker
container stop {CONTAINER_NAME}
docker
container stop {CONTAINER_ID}
$ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c9a1bfa89e1e jboss/wildfly "/opt/jboss/wildfly/…" 6 minutes ago Up 6 minutes 8080/tcp infallible_elgamal $ $ docker container stop c9a1bfa89e1e; c9a1bfa89e1e $ $ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
How to access the application running
in a container?
To access
the application that is running in a container, we should expose the container
ports outside. You can do that by using -P option.
Execute
the command ‘docker run -d -P jboss/wildfly’ in terminal.
-d : It
runs the container in detached mode
-P : Pick
a random port of the host system and redirect the requests that come to this
port to the container application.
$docker run -d -P jboss/wildfly 8ff3181fef3e45fb6d1996e39bdaf9fb695f48222e4ab0be116941817f20bb87 Execute the command ‘docker container ls’, to list all the running containers. $docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8ff3181fef3e jboss/wildfly "/opt/jboss/wildfly/…" About a minute ago Up About a minute 0.0.0.0:32768->8080/tcp naughty_poitras
As you see
the output of PORTS column, ‘0.0.0.0:32768->8080/tcp’, it means, you can
access the wildfly application at port 32768 from your localhost.
open the
url ‘http://localhost:32768/’ in browser, you can see below kind of screen.
No comments:
Post a Comment