Docker ServiceNow Image Deployment: How to Implement
This guide follows the docker-servicenow-image repo: a production Docker image for ServiceNow nodes built from install.sh, pushed to Amazon ECR for use in ECS, EKS, or Lambda-style workloads.
Prerequisites
- Docker
- AWS CLI configured (credentials with ECR push permission)
- ECR repository (create once, below)
One-time: Create ECR repository
AWS_REGION=us-east-1
aws ecr create-repository --repository-name servicenow --region "$AWS_REGION"
# Note the repositoryUri, e.g. 123456789012.dkr.ecr.us-east-1.amazonaws.com/servicenow
Build and push to ECR
Set your ECR URI and optionally region/tag, then run the repo's script:
export ECR_URI=123456789012.dkr.ecr.us-east-1.amazonaws.com/servicenow
export AWS_REGION=us-east-1
./build-push-ecr.sh # pushes as :latest
./build-push-ecr.sh v1.0.0 # pushes as :v1.0.0
Or in one line: ECR_URI=123456789012.dkr.ecr.us-east-1.amazonaws.com/servicenow ./build-push-ecr.sh v1.0.0
Runtime environment variables
When running the container (e.g. in an ECS task definition), set:
| Variable | Required | Description |
|---|---|---|
BUCKET | Yes* | S3 bucket containing the ServiceNow zip |
KEY | Yes* | S3 key of the zip (e.g. artifacts/sn.zip) |
JSON_PORTS | Yes | JSON array of ports, e.g. "[8443,9443]" |
NODE_PORT | No | Which node to start (default 8443; use 9443 for worker) |
JAVA_INSTALLER | No | Override Java package (default java-11-amazon-corretto-devel) |
* If BUCKET and KEY are not set, the entrypoint skips install and starts the node under /glide/nodes (for pre-baked images).
Dockerfile (from repo)
The image uses Amazon Linux 2, runs install.sh at container start when BUCKET/KEY are set, then starts the chosen node via docker-entrypoint.sh.
FROM amazonlinux:2
RUN yum install -y -q --nogpgcheck \
tar util-linux wget zip unzip gcc which vim curl nano zsh jq \
glibc glibc.i686 libgcc rng-tools awscli \
&& yum clean all
ENV JAVA_INSTALLER=java-11-amazon-corretto-devel
RUN yum install -y -q "${JAVA_INSTALLER}" && yum clean all
WORKDIR /app
COPY install.sh /app/install.sh
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
RUN chmod +x /app/install.sh /app/docker-entrypoint.sh
ENV NODE_PORT=8443
ENV JSON_PORTS="[8443,9443]"
ENTRYPOINT ["/app/docker-entrypoint.sh"]
Run locally (after push)
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com
docker run -e BUCKET=my-bucket -e KEY=path/sn.zip -e JSON_PORTS='[8443,9443]' -e NODE_PORT=8443 \
-p 8443:8443 \
123456789012.dkr.ecr.us-east-1.amazonaws.com/servicenow:latest
Repo files (schema)
| File | Role |
|---|---|
Dockerfile | Amazon Linux 2 base, deps + Java; runs install.sh at container start via entrypoint |
docker-entrypoint.sh | Runs install.sh when BUCKET/KEY set, then starts chosen node's startup.sh |
build-push-ecr.sh | Builds image and pushes to ECR (requires ECR_URI) |
Takeaways
- Use docker-servicenow-image for a production ServiceNow node image:
install.sh+docker-entrypoint.sh, ECR viabuild-push-ecr.sh. - Parameterize with
BUCKET/KEYfor install-at-start or omit for pre-baked; setNODE_PORTandJSON_PORTSfor the node to start. - Same image runs in ECS, EKS, or locally; keep credentials and instance URL out of the image (env or secrets at runtime).