<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splunk Docker container error &amp;quot;cannot create /opt/container_artifact/splunk-container.state: Permission denied&amp;quot;? in Security</title>
    <link>https://community.splunk.com/t5/Security/Splunk-Docker-container-error-quot-cannot-create-opt-container/m-p/428304#M10095</link>
    <description>&lt;P&gt;Answering my own question, in case it helps someone else...&lt;/P&gt;

&lt;P&gt;The error was caused by the introduction of an &lt;CODE&gt;ansible&lt;/CODE&gt; user into the base Splunk Docker image.&lt;/P&gt;

&lt;P&gt;My custom Dockerfile was setting the user to &lt;CODE&gt;splunk&lt;/CODE&gt; (or rather, the user specified by the corresponding environment variable). That caused a problem, because an updated shell script in the base Docker image was subsequently attempting to write to a file that the &lt;CODE&gt;ansible&lt;/CODE&gt; user could write to, but the &lt;CODE&gt;splunk&lt;/CODE&gt; user couldn't.&lt;/P&gt;

&lt;P&gt;I fixed the problem by changing the following line in my Dockerfile:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user ${SPLUNK_USER}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user ${ANSIBLE_USER}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I &lt;EM&gt;might&lt;/EM&gt; have been able to solve the problem by removing all &lt;CODE&gt;USER&lt;/CODE&gt; commands from my Dockerfile, and inserting &lt;CODE&gt;sudo&lt;/CODE&gt; in front of the &lt;CODE&gt;apt-get&lt;/CODE&gt; command in the "custom stuff" in that Dockerfile. However, after reading, but not fully understanding, some topics on the web that recommended against using &lt;CODE&gt;sudo&lt;/CODE&gt; in a Dockerfile (I'm neither a Unix expert nor a Docker expert), I decided against that approach.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2019 07:17:24 GMT</pubDate>
    <dc:creator>Graham_Hanningt</dc:creator>
    <dc:date>2019-08-06T07:17:24Z</dc:date>
    <item>
      <title>Splunk Docker container error "cannot create /opt/container_artifact/splunk-container.state: Permission denied"?</title>
      <link>https://community.splunk.com/t5/Security/Splunk-Docker-container-error-quot-cannot-create-opt-container/m-p/428303#M10094</link>
      <description>&lt;P&gt;I had been successfully using a custom Dockerfile to create a Docker container based on the Splunk-provided Docker image for Splunk 7.2.0:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;from splunk/splunk:7.2.0

user root

# Do custom stuff...

user ${SPLUNK_USER}

# Do more custom stuff...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(With apologies for being coy about the "custom stuff".)&lt;/P&gt;

&lt;P&gt;I wanted to upgrade to Splunk 7.3.0, so I updated the &lt;CODE&gt;FROM&lt;/CODE&gt; command to refer to the &lt;CODE&gt;7.3.0&lt;/CODE&gt; tag.&lt;/P&gt;

&lt;P&gt;That introduced the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sh: 1: cannot create /opt/container_artifact/splunk-container.state: Permission denied
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What changed between 7.2.0 and 7.3.0 to cause this error?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 07:08:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-Docker-container-error-quot-cannot-create-opt-container/m-p/428303#M10094</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-08-06T07:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Docker container error "cannot create /opt/container_artifact/splunk-container.state: Permission denied"?</title>
      <link>https://community.splunk.com/t5/Security/Splunk-Docker-container-error-quot-cannot-create-opt-container/m-p/428304#M10095</link>
      <description>&lt;P&gt;Answering my own question, in case it helps someone else...&lt;/P&gt;

&lt;P&gt;The error was caused by the introduction of an &lt;CODE&gt;ansible&lt;/CODE&gt; user into the base Splunk Docker image.&lt;/P&gt;

&lt;P&gt;My custom Dockerfile was setting the user to &lt;CODE&gt;splunk&lt;/CODE&gt; (or rather, the user specified by the corresponding environment variable). That caused a problem, because an updated shell script in the base Docker image was subsequently attempting to write to a file that the &lt;CODE&gt;ansible&lt;/CODE&gt; user could write to, but the &lt;CODE&gt;splunk&lt;/CODE&gt; user couldn't.&lt;/P&gt;

&lt;P&gt;I fixed the problem by changing the following line in my Dockerfile:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user ${SPLUNK_USER}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user ${ANSIBLE_USER}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I &lt;EM&gt;might&lt;/EM&gt; have been able to solve the problem by removing all &lt;CODE&gt;USER&lt;/CODE&gt; commands from my Dockerfile, and inserting &lt;CODE&gt;sudo&lt;/CODE&gt; in front of the &lt;CODE&gt;apt-get&lt;/CODE&gt; command in the "custom stuff" in that Dockerfile. However, after reading, but not fully understanding, some topics on the web that recommended against using &lt;CODE&gt;sudo&lt;/CODE&gt; in a Dockerfile (I'm neither a Unix expert nor a Docker expert), I decided against that approach.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 07:17:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-Docker-container-error-quot-cannot-create-opt-container/m-p/428304#M10095</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2019-08-06T07:17:24Z</dc:date>
    </item>
  </channel>
</rss>

