Building a custom Docker image from a deployable package
You can build custom Docker images that include your custom code or custom configurations, and then share and deploy the new images.
Note: If you are working on a local runtime environment for testing, development, or debugging
purposes, you might want to use a temporary method to quickly deploy changes to your local
environment. For more information, see Updating applications inside running Docker containers.
Before you begin
- In a development environment, build customization packages (
ts
,store
,search
,xc
) to include your custom code. For more information, see Building packages. - Download the customization packages to your runtime environment.
About this task
- Create a Dockerfile for each type of Docker image.
- Create a docker-compose.yml file that references the Dockerfiles to build the new images.
+search ++Dockerfile ++CusDeploy +store ++Dockerfile ++CusDeploy +app ++Dockerfile ++CusDeploy +web ++Dockerfile +xc ++Dockerfile ++CusDeploy +db ++Dockerfile +docker-compose.yml
Procedure
-
Create separate CusDeploy directories for each Docker image that you want
to customize.
For example,
- /opt/WebSphere/db/CusDeployNote: This is only applicable if you are running your database in a Docker container.
- /opt/WebSphere/search/CusDeploy
- /opt/WebSphere/store/CusDeploy
- /opt/WebSphere/xc/CusDeploy
- /opt/WebSphere/app/CusDeploy
- /opt/WebSphere/web/CusDeploy
- /opt/WebSphere/db/CusDeploy
-
Extract any customization packages that were created from the WCB utility to the appropriate
directory.
For example,
- Extract wcbd-deploy-server-ts-app.zip to /opt/WebSphere/app/CusDeploy.
- Extract wcbd-deploy-server-crs-app.zip to /opt/WebSphere/store/CusDeploy
- Extract wcbd-deploy-server-search-app.zip to /opt/WebSphere/search/CusDeploy
- Extract wcbd-deploy-server-xc-app.zip to /opt/WebSphere/xc/CusDeploy
-
Complete the following steps to create or update a Dockerfile to build a new search-app Docker
image.
-
Complete the following steps to create or update a Dockerfile to build a new
crs-app
(Store) Docker image. -
Complete the following steps to create or update a Dockerfile to build a new
ts-app
Transaction server Docker container image. -
Complete the following steps to create or update a Dockerfile to build a new
xc-app
(Customization) Docker image. -
Complete the following steps to create or update a Dockerfile to build a new
ts-web
(Web) Docker image. -
Complete the following steps to create or update a Dockerfile to build a new
ts-db
(Database) Docker image.Note: This is only applicable if you are running your database in a Docker container. -
Copy your existing docker-compose.yml file into the same directory that
holds your Docker directories.
For example, /opt/WebSphere/docker-compose.yml.
-
Edit the docker-compose.yml file to add build and
context parameters.
For example,
db: build: context: db image: <docker_registry>/commerce/ts-db:<tag> ... app: build: context: app image: <docker_registry>/commerce/ts-app:<tag> ... search: build: context: search image: <docker_registry>/commerce/search-app:<tag> ... store: build: context: store image: <docker_registry>/commerce/crs-app:<tag> ... web: build: context: web image: <docker_registry>/commerce/ts-web:<tag> ...
-
Stop and remove the existing running containers.
For example, you can run the following command:
docker-compose -f docker-compose.yml rm
-
Run the following command to build the new images.
docker-compose -f docker-compose.yml build
Note: If you want to build and then deploy the containers in one command, you can usedocker-compose -f docker-compose.yml up --build -d