oracle / docker-images

Official source of container configurations, images, and examples for Oracle products and projects
https://developer.oracle.com/use-cases/#containers
Universal Permissive License v1.0
6.52k stars 5.42k forks source link

Which user should i build images and run containers? #750

Closed fabiosakiyama closed 6 years ago

fabiosakiyama commented 6 years ago

Hi,

I'm trying to start a WebLogic 12.2.1.3.0 container, but i'm having permissions issues. I'm not sure how should i execute the docker build/run commands, regarding the user. Should i use root or oracle user?

Thanks in advance!

Djelibeybi commented 6 years ago

Please provide the actual output/error messages. We can't really assist until we can see the actual error.

fabiosakiyama commented 6 years ago

Sorry,

After building the following images: dockerimages

I ran: docker run -d --name wlsadmin --hostname wlsadmin -p 7001:7001 --env-file ./container-scripts/domain.properties -e ADMIN_PASSWORD=mypass -v /home/oracle/docker/volumes/teste/:/u01/oracle/user_projects 12213-domain

And got the following error:

Initializing WebLogic Scripting Tool (WLST) ...

 Welcome to WebLogic Server Administration Scripting Shell

 Type help() for help on available commands

 domain_name     : [abc_domain]
 admin name      : [AdminServer]
 admin_port      : [7001]
 cluster_name    : [DockerCluster]
 domain_path     : [/u01/oracle/user_projects/domains/abc_domain]
 production_mode : [dev]
 com.oracle.cie.domain.script.ScriptException: 60308: Domain location not writable.
 60308: The domain location does not have write permission.
 60308: Correct permissions or select different domain location.

        at com.oracle.cie.domain.script.ScriptExecutor.writeDomain(ScriptExecutor.java:2035)
        at com.oracle.cie.domain.script.jython.WLScriptContext.writeDomain(WLScriptContext.java:1793)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.oracle.cie.domain.script.jython.WLSTState.processCommand(WLSTState.java:225)
        at com.oracle.cie.domain.script.jython.WLScriptContext.runCmd(WLScriptContext.java:729)
        at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.python.core.PyReflectedFunction.__call__(Unknown Source)
        at org.python.core.PyMethod.__call__(Unknown Source)
        at org.python.core.PyObject.__call__(Unknown Source)
        at org.python.core.PyInstance.invoke(Unknown Source)
        at org.python.pycode._pyx5.command$1(/tmp/WLSTOfflineIni990322522804248718.py:19)
        at org.python.pycode._pyx5.call_function(/tmp/WLSTOfflineIni990322522804248718.py)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyFunction.__call__(Unknown Source)
        at org.python.pycode._pyx5.writeDomain$26(/tmp/WLSTOfflineIni990322522804248718.py:107)
        at org.python.pycode._pyx5.call_function(/tmp/WLSTOfflineIni990322522804248718.py)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyFunction.__call__(Unknown Source)
        at org.python.pycode._pyx36.f$0(/u01/oracle/create-wls-domain.py:81)
        at org.python.pycode._pyx36.call_function(/u01/oracle/create-wls-domain.py)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyCode.call(Unknown Source)
        at org.python.core.Py.runCode(Py.java:1226)
        at org.python.util.PythonInterpreter.execfile(Unknown Source)
        at weblogic.management.scripting.WLST.main(WLST.java:186)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at weblogic.WLST.main(WLST.java:47)
 Problem invoking WLST - Traceback (innermost last):
   File "/u01/oracle/create-wls-domain.py", line 81, in ?
   File "/tmp/WLSTOfflineIni990322522804248718.py", line 107, in writeDomain
   File "/tmp/WLSTOfflineIni990322522804248718.py", line 19, in command
 60308: Domain location not writable.
 60308: The domain location does not have write permission.
 60308: Correct permissions or select different domain location.

        at com.oracle.cie.domain.script.jython.CommandExceptionHandler.handleException(CommandExceptionHandler.java:69)
        at com.oracle.cie.domain.script.jython.WLScriptContext.handleException(WLScriptContext.java:2983)
        at com.oracle.cie.domain.script.jython.WLScriptContext.runCmd(WLScriptContext.java:735)
        at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)

 com.oracle.cie.domain.script.jython.WLSTException: com.oracle.cie.domain.script.jython.WLSTException: Error writing domain                                                                                                                                                            :
 60308: Domain location not writable.
 60308: The domain location does not have write permission.
 60308: Correct permissions or select different domain location.
Djelibeybi commented 6 years ago

You need to make sure that /home/oracle/docker/volumes/teste/ is writable by a user with the uid and gid of 1000:1000. That matches the oracle user inside the WebLogic container.

fabiosakiyama commented 6 years ago

Hi,

I'm not sure if i get it.

I have an oracle user on my server: uid=501(oracle) gid=501(oinstall) groups=501(oinstall),498(docker)

So i have to change the uid of that user to 1000 and the gid of oinstall to 1000?

Thanks in advance!

PS: Seeing the dockerfile, it seems that i need an 'oracle' group as well and use it instead of 'oinstall' group. Is that correct?

PS2: I changed the name of the 'oinstall' group to 'oracle' but it didnt work.

Djelibeybi commented 6 years ago

It doesn't matter what the name of the user or group is on your host, as long as the uid is 1000 and the gid is 1000.

fabiosakiyama commented 6 years ago

It worked! Thanks!

jayaramnagarajan commented 6 years ago

I m facing the same issue. Pulled in Docker WebLogic image, trying to create domain using oracle provided scripts and getting this error 60308: Domain location not writable. 60308: The domain location does not have write permission. 60308: Correct permissions or select different domain location. Checked the uid and gid and says 1000 [oracle@ef605ef858e2 ~]$ id uid=1000(oracle) gid=1000(oracle) groups=1000(oracle)

Not sure what i am missing here. Any help is appreciated.

beide commented 5 years ago

which command do you run to make it writable? I am in the OCI /home/opc directory as host directory but still getting the same errors.

pinfrederic commented 5 years ago

Add -u 1000:1000 to your docker run command

beide commented 5 years ago

Yes, I tried the -u 1000:1000 option with docker run and still the same problem.

beide commented 5 years ago

I ma using https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image and instructions in the readme.

aivl2018 commented 5 years ago

same issue/Error occurred for me as well. Tried with above option still getting below error . domain_name : [base_domain] admin name : [AdminServer] admin_port : [7001] cluster_name : [DockerCluster] domain_path : [/u01/oracle/user_projects/domains/base_domain] production_mode : [prod] com.oracle.cie.domain.script.ScriptException: 60308: Domain location not writable. 60308: The domain location does not have write permission. 60308: Correct permissions or select different domain location.

    at com.oracle.cie.domain.script.ScriptExecutor.writeDomain(ScriptExecutor.java:2035)