How do I run AMPS in a Docker container?

Follow

The 60East engineering team has used Docker with AMPS for our own internal testing, but we have stopped short of recommending it or providing extensive documentation how to use Docker. In our experience, the performance of the Docker network bridge/NAT layer that used by default isn't really suitable for the kinds of apps most people want to build with AMPS.

Having said that, if you want to use Docker with AMPS for development purposes, it's not hard to do.

Here's a short guide:

1. Create a file called Dockerfile in the same directory with an AMPS configuration file (config.xml) that you want to use:

FROM ubuntu 
MAINTAINER 60East Technologies <support@crankuptheamps.com>
ADD <link-to-AMPS-distribution-archive> /binaries/AMPS.tar
COPY config.xml /
RUN ls -l /
RUN ls -l /binaries
RUN tar xvf /binaries/AMPS.tar --transform='s,AMPS[^/]*/,AMPS/,'
RUN ls -l /

# expose websocket and TCP port (adjust as needed for your AMPS config file)
EXPOSE 9007
EXPOSE 9008

# expose Admin port (adjust as needed for your AMPS config file)
EXPOSE 8085

CMD ["/AMPS/bin/ampServer","config.xml"]

Notice that in the ADD instruction we need to replace <link-to-AMPS-distribution-archive> with the actual download link of the AMPS Server of the version that will be used.

2. Build the container: 

docker build .

Once built, the the container id for the AMPS container will be listed, for example:

Successfully built 377c409b35e4

 3. Use the container id to Start the AMPS container: 

docker run -p 8085:8085 -p 9007:9007 -p 9008:9008 <container_id>

Notice that the command uses the -p flag to publish the ports that AMPS uses from the container to the host. We've attached an archive with the Dockerfile and a sample AMPS configuration file. You can replace/modify the configuration file and the docker file to fit your needs.

We recommend that any Linux system that hosts AMPS be tuned as described in the Linux Operating System Configuration section of the AMPS User Guide.

Have more questions? Submit a request

Comments

Powered by Zendesk