Giter Site home page Giter Site logo

openliberty / guide-docker Goto Github PK

View Code? Open in Web Editor NEW
10.0 7.0 19.0 410 KB

A guide on how to use Docker containers for iterative development of microservices: https://openliberty.io/guides/docker.html

Home Page: https://openliberty.io/guides/docker.html

License: Other

Java 41.43% HTML 32.84% Dockerfile 7.52% Shell 18.21%

guide-docker's Introduction

Using Docker containers to develop microservices

Note
This repository contains the guide documentation source. To view the guide in published form, view it on the Open Liberty website.

Learn how to use Docker containers for iterative development.

What you’ll learn

You will learn how to set up, run, and iteratively develop a simple REST application in a container with Open Liberty and Docker.

Open Liberty is a lightweight open framework for building fast and efficient cloud-native Java microservices. It’s small, lightweight, and designed with modern cloud-native application development in mind. Open Liberty simplifies the development process for these applications by automating the repetitive actions associated with running applications inside containers, like rebuilding the image and stopping and starting the container.

You’ll also learn how to create and run automated tests for your application and container.

The implementation of the REST application can be found in the start/src directory. To learn more about this application and how to build it, check out the Creating a RESTful web service guide.

What is Docker?

Docker is a tool that you can use to deploy and run applications with containers. You can think of Docker like a virtual machine that runs various applications. However, unlike a typical virtual machine, you can run these applications simultaneously on a single system and independent of one another.

Learn more about Docker on the official Docker website.

What is a container?

A container is a lightweight, stand-alone package that contains a piece of software that is bundled together with the entire environment that it needs to run. Containers are small compared to regular images and can run on any environment where Docker is set up. Moreover, you can run multiple containers on a single machine at the same time in isolation from each other.

Learn more about containers on the official Docker website.

Why use a container to develop?

Consider a scenario where you need to deploy your application on another environment. Your application works on your local machine, but when you try to run it on your cloud production environment, it breaks. You do some debugging and discover that you built your application with Java 8, but this cloud production environment has only Java 11 installed. Although this issue is generally easy to fix, you don’t want your application to be missing dozens of version-specific dependencies. You can develop your application in this cloud environment, but that requires you to rebuild and repackage your application every time you update your code and wish to test it.

To avoid this kind of problem, you can instead choose to develop your application in a container locally, bundled together with the entire environment that it needs to run. By doing this, you know that at any point in your iterative development process, the application can run inside that container. This helps avoid any unpleasant surprises when you go to test or deploy your application down the road. Containers run quickly and do not have a major impact on the speed of your iterative development.

Additional prerequisites

Before you begin, you need to install Docker if it is not already installed. For installation instructions, refer to the official Docker documentation. You will build and run the application in Docker containers.

Make sure to start your Docker daemon before you proceed.

Creating the Dockerfile

The first step to running your application inside of a Docker container is creating a Dockerfile. A Dockerfile is a collection of instructions for building a Docker image that can then be run as a container. Every Dockerfile begins with a parent or base image on top of which various commands are run. For example, you can start your image from scratch and run commands that download and install Java, or you can start from an image that already contains a Java installation.

Navigate to the start directory to begin.

Create the Dockerfile in the start directory.
Dockerfile

Dockerfile

link:finish/Dockerfile[role=include]

The FROM instruction initializes a new build stage and indicates the parent image from which your image is built. If you don’t need a parent image, then use FROM scratch, which makes your image a base image.

In this case, you’re using the icr.io/appcafe/open-liberty:kernel-slim-java11-openj9-ubi image as your parent image, which comes with the latest Open Liberty runtime.

The COPY instructions are structured as COPY [--chown=<user>:<group>] <source> <destination>. They copy local files into the specified destination within your Docker image. In this case, the Liberty configuration file that is located at src/main/liberty/config/server.xml is copied to the /config/ destination directory.

Writing a .dockerignore file

.dockerignore

link:finish/.dockerignore[role=include]

When Docker runs a build, it sends all of the files and directories that are located in the same directory as the Dockerfile to its build context, making them available for use in instructions like ADD and COPY. If there are files or directories you wish to exclude from the build context, you can add them to a .dockerignore file. By adding files that aren’t nessecary for building your image to the .dockerignore file, you can decrease the image’s size and speed up the building process. You may also want to exclude files that contain sensitive information, such as a .git folder or private keys, from the build context.

A .dockerignore file is available to you in the start directory. This file includes the pom.xml file and some system files.

Launching Open Liberty in dev mode

The Open Liberty Maven plug-in includes a devc goal that builds a Docker image, mounts the required directories, binds the required ports, and then runs the application inside of a container. This dev mode, also listens for any changes in the application source code or configuration and rebuilds the image and restarts the container as necessary.

Build and run the container by running the devc goal from the start directory:

mvn liberty:devc

After you see the following message, your Liberty instance is ready in dev mode:

**************************************************************
*    Liberty is running in dev mode.

Open another command-line session and run the following command to make sure that your container is running and didn’t crash:

docker ps

You should see something similar to the following output:

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                                    NAMES
ee2daf0b33e1        guide-docker-dev-mode   "/opt/ol/helpers/run…"   2 minutes ago       Up 2 minutes        0.0.0.0:7777->7777/tcp, 0.0.0.0:9080->9080/tcp, 0.0.0.0:9443->9443/tcp   liberty-dev

To view a full list of all available containers, you can run the docker ps -a command.

If your container runs without problems, go to the http://localhost:9080/system/properties URL swhere you can see a JSON response that contains the system properties of the JVM in your container.

Updating the application while the container is running

With your container running, make the following update to the source code:

Update the PropertiesResource class.
src/main/java/io/openliberty/guides/rest/PropertiesResource.java

PropertiesResource.java

link:finish/src/main/java/io/openliberty/guides/rest/PropertiesResource.java[role=include]

Change the endpoint of your application from properties to properties-new by changing the @Path annotation to "properties-new".

After you make the file changes, Open Liberty automatically updates the application. To see these changes reflected in the application, go to the http://localhost:9080/system/properties-new URL.

Testing the container

You can test this service manually by starting a Liberty instance and going to the http://localhost:9080/system/properties-new URL. However, automated tests are a much better approach because they trigger a failure if a change introduces a bug. JUnit and the JAX-RS Client API provide a simple environment to test the application. You can write tests for the individual units of code outside of a running Liberty instance, or you can write them to call the instance directly. In this example, you will create a test that calls the instance directly.

Create the EndpointIT test class.
src/test/java/it/io/openliberty/guides/rest/EndpointIT.java

EndpointIT.java

link:finish/src/test/java/it/io/openliberty/guides/rest/EndpointIT.java[role=include]

This test makes a request to the /system/properties-new endpoint and checks to make sure that the response has a valid status code, and that the information in the response is correct.

You will see the following output:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running it.io.openliberty.guides.rest.EndpointIT
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.884 sec - in it.io.openliberty.guides.rest.EndpointIT

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

When you are finished, press CTRL+C in the session that the dev mode was started from to stop and remove the container.

Starting dev mode with run options

Another useful feature of dev mode with a container is the ability to pass additional options to the docker run command. You can do this by adding the dockerRunOpts tag to the pom.xml file under the configuration tag of the Liberty Maven Plugin. Here is an example of an environment variable being passed in:

<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.10</version>
<configuration>
    <dockerRunOpts>-e ENV_VAR=exampleValue</dockerRunOpts>
</configuration>

If the Dockerfile isn’t located in the directory that the devc goal is being run from, you can add the dockerfile tag to specify the location. Using this parameter sets the context for building the Docker image to the directory that contains this file.

Additionally, both of these options can be passed from the command line when running the devc goal by adding -D as such:

mvn liberty:devc \
-DdockerRunOpts="-e ENV_VAR=exampleValue" \
-Ddockerfile="./path/to/file"

To learn more about dev mode with a container and its different features, check out the Documentation.

Great work! You’re done!

You just iteratively developed a simple REST application in a container with Open Liberty and Docker.

guide-docker's People

Contributors

ahmad-ayyoub avatar andrewdes avatar austinseto avatar chyt avatar davidwyao avatar dependabot[bot] avatar evelinec avatar gkwan-ibm avatar griffinhadfield avatar justineechen avatar kinueng avatar kubik42 avatar lauracowen avatar maihameed avatar nimg98 avatar proubatsis avatar ryan-storey avatar scottkurz avatar siwany avatar t27gupta avatar tt-le avatar wasdevb1 avatar yeekangc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

guide-docker's Issues

Multipane Issues

Building your application

  • Does this guide need the clean goal? I thought we were removing clean from the guides

Creating the Dockerfile

  • This guide does not tell users to "Navigate to the start directory" before giving instructions to modify/create files.
  • Path to Dockerfile includes "start" directory: start/Dockerfile (only applicable if point above is taken into consideration)

Optional: Writing a .dockerignore file

  • Feel free to add anything else that you want to exclude -> No period at the end of the sentence
  • Should the .dockerignore file be hotspotted and displayed on the right pane?

Containerize your application

  • "Now that your image is built, execute the Docker run command with the absolute path to this guide, from the command line to run it:" -> "from the command line to run it:" needs to be reworded
  • "This flag gives the container a name." -> The description for the --name flag could be improved. The flag allows you to specify/give the container a name, I feel like the current description makes it sounds as though the --name flag automatically gives the container a name
  • For example, if your servers directory also contains a server called testServer, then it can be started as shown in the following example: -> Should the command listed after be copyable? Since it is copyable it could be misleading, because we don't actually want users to run this command do we?

Testing the container

  • The path for the PropertiesResource class has the start directory in it (start/src/main/java/io/openliberty/guides/rest/PropertiesResource.java), if we want to be consistent with other guides we should tell users to navigate to the start directory at the beginning and omit it from paths

 

Hardcoded path in automation test

The current automation test hardcodes the path /home/travis/build/OpenLiberty in the test command. This may be a problem?

docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v /home/travis/build/OpenLiberty/guide-docker/finish/target/liberty/wlp/usr/servers:/servers ol-runtime

Python example seems odd in Java guide

I was just reading the Docker guide and the intro bit uses having multiple versions of Python as an example of why you might want to use containers. At the point where it says "You can also run multiple containers on a single machine in isolation from one another so that two containers that have different versions of Python do not interfere with each other." it makes me wonder why I'm going to be doing Python stuff in this guide. I think the Python example is fine for a generic explanation of why Docker/containers are useful but it doesn't seem very relevant to a guide on writing Java apps for a Java app server.

More importantly, it doesn't explain why someone working with Open Liberty or Java EE/MP would want to use a Docker environment for development. Which would be more important to someone pondering whether to continue reading/doing the Docker guide.

Improvements to Docker guide

I suggest we update the Docker guide to demonstrate the best practices as outlined in https://github.com/OpenLiberty/ci.docker#building-an-application-image

It should:

  • start from the official image (I would recommend the UBI image, such as openliberty/open-liberty:full-java8-openj9-ubi)
  • copy the server.xml and application (using chown)
  • call configure.sh (this will do things like start/stop the server for improved performance)
  • avoid using volumes, unless it's for things like keystore / cert which are usually bound in a k8s env.

We don't need to use the ENTRYPOINT or CMD instructions because that's already present in the official OL images.

Multipane Issues

  • <execution /> element tag in Building your application has the slash in the wrong place

  • PropertiesResource should be one word in Testing the container and file should be removed

  • Change the endpoint of your application from /properties to /properties-new by replacing the PropertiesResource.java class and changing the @Path annotation to "properties-new".*
    should be
    Change the endpoint of your application from /properties to /properties-new by changing the @Path annotation to "properties-new".*

Acessibility violation with table

The violation is reported as openliberty.io issue: OpenLiberty/openliberty.io#230

After further investigation, the problem is with the table itself. To fix the accessibility violation, Add options="header" to the table attribute list. There are two tables in this guide and both have to change to add the options attribute.

[cols="70, 100", options="header"]
[cols="15, 100", options="header"]

Update guide to use devc mode

refactor the guide

  • use new LMP for devmode with container

  • use ideal Dockefile

  • use ideal pom

  • use latest mp

  • use jakartaee

  • use dev mode

  • #72

  • remove jdk9+ dependencies OpenLiberty/guides-common#459 (was able to remove all except for one)

  • Update tests to JUnit 5

  • Rewrite guide for devmode with container

Replace <absolute-path> prompt with $(pwd) command

Just an enhancement upgrade to use the $(pwd) command substitution in place of asking the user to manually input the absolute path to the current working directory.

i.e. instead of:

docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v <absolute path to guide>/start/target/liberty/wlp/usr/servers:/servers ol-runtime

replace with"

docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v $(pwd)/target/liberty/wlp/usr/servers:/servers ol-runtime

since the user is already in the start/ directory.

Guide breakage

Docker Intro

  • End-to-end on Mac
  • Running Java openj9-0.14.0, JRE 11

Running mvn install automatically triggers the tests, which obviously fail since no containers are running:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running it.io.openliberty.guides.rest.EndpointTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.cxf.common.util.ReflectionUtil$11 (file:/Users/maihameed%40ibm.com/.m2/repository/org/apache/cxf/cxf-core/3.2.6/cxf-core-3.2.6.jar) to field java.net.Authenticator.theAuthenticator
WARNING: Please consider reporting this to the maintainers of org.apache.cxf.common.util.ReflectionUtil$11
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.519 sec <<< FAILURE! - in it.io.openliberty.guides.rest.EndpointTest
testGetProperties(it.io.openliberty.guides.rest.EndpointTest)  Time elapsed: 1.519 sec  <<< FAILURE!
java.lang.AssertionError: Incorrect response code from http://localhost:9080/LibertyProject/ expected:<200> but was:<404>
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.failNotEquals(Assert.java:834)
	at org.junit.Assert.assertEquals(Assert.java:645)
	at it.io.openliberty.guides.rest.EndpointTest.testGetProperties(EndpointTest.java:53)


Results :

Failed tests:
  EndpointTest.testGetProperties:53 Incorrect response code from http://localhost:9080/LibertyProject/ expected:<200> but was:<404>

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

The Test section of the guide makes no mention of the EndpointTest nor does it prompt the user to run any sort of tests.

image

In addition, telling the user to update the file to a new endpoint won't come into effect unless the Docker image is rebuilt, the instructions do not reflect this, and instead tells the user to simply run mvn package and view the updated endpoint which does not work.

Guide will probably need to be looked into.

This will probably be addressed in the dev-mode update.

Originally posted by @MaiHameed in OpenLiberty/guides-common#390 (comment)

Cannot run docker container on MacOS

In the finished directory I executed following commands:
mvn clean install
docker build -t ol-runtime .
docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v /MY_ABSOLUTE_PATH_TO_FINISHED_DIR/target/liberty/wlp/usr/servers:/servers ol-runtime

However, container failed with the following error (can see by executing docker logs rest-app:

JVMSHRC155E Error copying username into cache name
JVMSHRC686I Failed to startup shared class cache. Continue without using it as -Xshareclasses:nonfatal is specified
CWWKE0005E: The runtime environment could not be launched.
CWWKE0044E: There is no write permission for server directory /opt/ol/wlp/output/defaultServer

MacOS Mojave: v10.14.4

Build Failure!!!!!

Hello, Helpppp!
I'm trying to install the mvn but it has an error in the test, specifying more by executing the mvn install -X command it has an error

[INFO] Failsafe report directory: C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start\target\test-reports\it
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.409 s
[INFO] Finished at: 2020-06-12T17:36:19-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (verify-results) on project rest: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start\target\test-reports\it for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (verify-results) on project rest: There are test failures.

Please refer to C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start\target\test-reports\it for the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start\target\test-reports\it for the individual test results.
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution (SurefireHelper.java:82)
at org.apache.maven.plugin.failsafe.VerifyMojo.execute (VerifyMojo.java:195)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start>docker run -it --rm -v ${PWD}/docker:/exporter --env-file ./docker/.env -e mvn_flags=-DexcludedGroups=com.sap.psr.vulas.shared.categories.RequiresNetwork vulas-build-img
docker: open ./docker/.env: The system cannot find the path specified.
See 'docker run --help'.

C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start>
C:\Users\gabri\OneDrive\Documentos\docker\guide-docker\start>docker run -it --rm -v ${PWD}/docker:/exporter --env-file ./docker/.env -e mvn_flags=-DexcludedGroups=com.sap.psr.vulas.shared.categories.RequiresNetwork vulas-build-img

Starting docker container command has incorrect volume path

Command contains extra /app/ folder which doesn't exists causing server to point into wrong directory

docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v <absolute path to guide>/start/app/target/liberty/wlp/usr/servers:/servers ol-runtime

Should be:
docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v <absolute path to guide>/start/target/liberty/wlp/usr/servers:/servers ol-runtime

There are 2 places in the instructions where this happens

Update guide to have more descriptive title

In Slack (and probably other chat platforms), this guide is using the default title Open Liberty. Let's add more details to the title that is specific to this guide. See picture below from Slack that shows the difference with this docker guide relative to the other guides' titles.

image

Can't seem to be able to run the file after compiling it

After running docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v <absolute path to guide>/start/target/liberty/wlp/usr/servers:/servers ol-runtime testServer from the guide, I can't get into the server. Here is the output:

curl http://localhost:9080/LibertyProject/System/properties
curl: (56) Recv failure: Connection reset by peer

Please advise.

dockerfile when ready to build app image

This guide shows how to setup development with a continuously running open liberty docker container. Two questions

  1. Why would we want to create our own custom docker image just to run open liberty? Eg. docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v <absolute path to guide>/start/target/liberty/wlp/usr/servers:/servers ol-runtime
    When it seems that we could reference the official image
    docker run -d --name rest-app -p 9080:9080 -p 9443:9443 -v <absolute path to guide>/start/target/liberty/wlp/usr/servers:/liberty/usr/servers open-liberty

  2. What should the dockerfile look like when we are ready to create an image including the application? I read about copying the .war and server.xml to the /config dir. Or is it sufficient to copy the target servers directory as the docker mount argument. What are best practices?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.