{"id":14244,"date":"2020-06-03T23:52:28","date_gmt":"2020-06-03T23:52:28","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=14244"},"modified":"2021-11-05T10:55:07","modified_gmt":"2021-11-05T10:55:07","slug":"deploying-newrelic-agent-in-docker-image-using-dockerfile-for-tomcat-and-java","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/deploying-newrelic-agent-in-docker-image-using-dockerfile-for-tomcat-and-java\/","title":{"rendered":"Deploying NewRelic Agent in Docker Image using Dockerfile for Tomcat and Java"},"content":{"rendered":"\n<p>It doesn\u2019t actually matter where you put the New Relic agent. All that matters is that the agent and its support files (including newrelic.yml) are in the same folder, and that you set the -javaagent property of your JVM to point to the location of the newrelic.jar file.<\/p>\n\n\n\n<p>A very important thing to know: your startup script (the one which contains the command that starts your application server) must include Java\u2019s built-in argument called &#8220;-javaagent&#8221;, and the value of that argument must be the location of wherever you unzipped the newrelic agent. For example, &#8220;-javaagent:\/usr\/local\/tomcat\/newrelic\/newrelic.jar&#8221;.<\/p>\n\n\n\n<p>Let\u2019s say that you were testing out deploying a single Java web application, using Docker and New Relic. These 2 files might be all you need:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/a94965d2a613d3b303a613cdde2386a2.js\"><\/script>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_26868\"><iframe loading=\"lazy\"  id=\"_ytid_73178\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_26868\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>It doesn\u2019t actually matter where you put the New Relic agent. All that matters is that the agent and its support files (including newrelic.yml) are in the same folder, and&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-14244","post","type-post","status-publish","format-standard","hentry","category-sql"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=14244"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14244\/revisions"}],"predecessor-version":[{"id":24801,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14244\/revisions\/24801"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=14244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=14244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=14244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}