Creating an mlcp docker container with pre-loaded data — marklogic developer community


Sometimes it’s useful to be able to pass around a known dataset to use in dev, testing, and QA activities. Binary algorithm This blog will show you how to create a Docker image with a known dataset and then use it to deploy that data to a MarkLogic instance using the container’s MLCP library. Usd inr live Without further ado, let’s get started! Assumptions
RUN wget –no-cookies –no-check-certificate –header “Cookie: oraclelicense=accept-securebackup-cookie” “$JAVA_VERSION-$BUILD_VERSION/jdk-$JAVA_VERSION-linux-x64.rpm” -O /tmp/jdk-8-linux-x64.rpm && \
Let’s look at what’s going on in the Dockerfile. Nz to usd First, we’re basing our image on Centos 7 and then we’re updating our yum package manager while installing the necessary libraries we’ll need for our environment. Funny jokes tagalog Next, we set some environment variables and then install Java JDK. Understanding futures markets kolb pdf After that, we’re copying some required scripts and MLCP configuration files (we’ll create them next) and then adding the necessary permissions to the script. Convert currency Lastly, I’m setting a few more environment variables to be used inside the scripts and then setting the default “entrypoint” script to run by default when the container is started.
• ENV CONFIG_FILE_PATH – You shouldn’t have to modify this unless you change where the mlcp_config.txt file is copied to or you change the name of the config file itself.
printf “Optional Parameters:
\t–fastload {no arguments}
\t–output_cleandir {no arguments}
PARSED_OPTIONS=$(getopt -n “$0” -o h:: –long “host:,port:,username:,password:,batch_size::,database::,fastload,namespace::,output_cleandir,output_collections::,output_directory::,output_uri_prefix::,output_uri_suffix::,tolerate_errors” — “$@”)
This file is fairly well commented so it should be pretty self-explanatory. Free language translator download Basically, this file will ensure the container stays running and will parse the arguments we pass to the Docker Run command when we instantiate the container to run MLCP.
This file can be filled in or left empty. Chicago futures market It’s purpose is to allow the individual building the initial image to enter MLCP options he/she knows will be required based upon the type of data stored in our container. 1 usd to danish krone Ensure you follow proper formatting for this file. Cdn to usd conversion The basic format is: -output_uri_replace
• Last, we need some data to import. The financial futures market For this post, I’ve used MLCP to export an archive from an existing MarkLogic database and copied it to the data folder. Commodity futures intraday market price quotes You can use any data set you like, just put it in the data folder and update the MLCP options in your Dockerfile.
Here is what your folder structure should look like. Euro usd fx Note, there’s a file called mlcp_possible_options.txt in my example below. Market data live futures quotes You can ignore it for the purposes of this tutorial. In the screen shot below, my data folder contains archives of metadata and binaries I sampled from an existing MarkLogic database.
Now we have the necessary scripts, data, and have created our Dockerfile. Dollar to inr rate today Let’s go ahead and build the image. Dow stock futures cnn Open a terminal window and ensure you’re in our working directory, then enter: docker build -t : .
Note: It would probably be beneficial to create a “base” MLCP image with the necessary libraries and then use it as the base for subsequent data-specific images.

The boxer rebellion That way, every time you build the image with new data, all of the required libraries are already part of the image and don’t have to be reinstalled each time the image is created. Usd to cny exchange rate I’ll list the steps required to build an MLCP Base image at the end of this blog. Silver chart 5 year Running the Container
Running the container is easy just enter the following: docker run –rm : –host –username admin –password password –port This is by no means an all inclusive list, but the savvy user could easily modify the script to support additional arguments and don’t forget that there is an MLCP options file to use.
That’s it! You now have an MLCP Docker container to store pre-defined datasets that you can pass around to use for dev, testing, and SQA activities. European stock market futures Enjoy!! Building an MLCP Base Image
Assuming you followed the steps outlined at the beginning of this blog to build the MLCP Image, you can easily modify them for creating a “Base” image. Love quotes for boyfriend This way, you’ll have an image with all the necessary libraries already baked in and the only thing you’ll need to do is create a new image based on the Base image and include the data you need in the container with the necessary configurations.
• Save the file and then run the Docker Build command. Fraction operations In this example I’ve called the image mlcp_base and provide a versioning tag v1. Cnn pre stock market futures You can obviously call it whatever you like and use whatever tagging convention makes sense for you. Free format converter (Don’t forget to prefix the image name with your registry if you’re publishing to a registry)
• If you created an options file, modify it as required to support the necessary MLCP Import options you need based on the data you’re using for this image and then save it.
So for example, you could call it my_registry/mlcp_enron:latest or my_registry/mlcp:enron. Binary to words You should notice the build process doesn’t take as long (depending on the size of the dataset you’re copying to the image). Euro usd converter That’s it! You now have a recipe for creating a data-specific MLCP image.

Leave a Reply

Your email address will not be published. Required fields are marked *