LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-30-2016, 04:43 AM   #1
janas03
LQ Newbie
 
Registered: Apr 2008
Location: Warsaw, Poland
Distribution: Slackware64 14.2
Posts: 29

Rep: Reputation: 4
Slackware Docker image with Oracle JRE and some other stuff


I am working on some product that will be running on Docker and my question is about Docker containers (based on Slackware, of course). I have found Slackware Docker image (thanks to Vincent Batts) on DockerHub.

I need to run some Java based application so I built a package with OracleJRE and I install it while building Docker image. The problem is that java is not visible in the container so it turned out that I have to source jre.sh from /etc/profile.d. I made up a wrapper script that runs
Code:
profile_dir=/etc/profile.d

source $profile_dir/term.sh
source $profile_dir/z-dot-in-non-root-path.sh
source $profile_dir/lang.sh
source $profile_dir/jre.sh
before my Java app is started. Is this the right way to do? I haven't found anything similar (I mean sourcing) in the official openJRE images.

I would also like to set timezone to UTC in a non-interactive way. Is
Code:
cp /usr/share/zoneinfo/UTC /etc/localtime
enough?

And, last but not least, I would like to set encoding to UTF-8, also in non-interactive way. From what I know I should modify /etc/profile.d/lang.sh and copy it while building Docker image. Do you see room for improvement in my process?
 
Old 11-30-2016, 07:17 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Can't really help with the Java stuff but I can comment that I have a couple of Java applications that work "best" with Oracle Java -- I install the JDK version (which includes JRE) using the Java build in the /exta directory. I've tried Open Java, didn't work, went back to Oracle and no problems. The SlackBuild installs all the stuff in /etc for it.

Other applications, specifically some data base things, need UTF-8.

You edit /etc/profile.d/lang.sh like this:
Code:
cat lang.sh
#!/bin/sh
# Set the system locale.  (no, we don't have a menu for this ;-)
# For a list of locales which are supported by this machine, type:
#   locale -a

# en_US is the Slackware default locale:
#export LANG=en_US

# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968.  These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
#export LANG=C

# There is also support for UTF-8 locales, but be aware that
# some programs may possibly misbehave under UTF-8.  In those
# cases, you can set LANG=C before starting them.  Note that
# there are some UTF-8 locales that do not contain UTF-8 or
# utf8 in the locale name, so to test if a locale is UTF-8,
# use this command:
#
# LANG=<locale> locale -k charmap
#
# UTF-8 locales will include "UTF-8" in the output.
#
export LANG=en_US.UTF-8

# Another option for en_US:
#export LANG=en_US.ISO8859-1

# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
# change in many places.  Since this isn't usually expected and
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
export LC_COLLATE=C

# End of /etc/profile.d/lang.sh
and you're good to go but you need to stop your window manager, log out, log back in, startx. Then run
Code:
locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=C
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
You do want to change the "us" to "pl" (I think that's the code for Poland). It won't hurt anything that you've set the locale to UTF-8, pretty much everything works with a couple of old things that don't like it. When you set locale, you set it system-wide so you're not setting it dynamically.

Hope this helps some.
 
Old 11-30-2016, 08:29 AM   #3
janas03
LQ Newbie
 
Registered: Apr 2008
Location: Warsaw, Poland
Distribution: Slackware64 14.2
Posts: 29

Original Poster
Rep: Reputation: 4
Thank you for your effort tronayne. I built Java package using the SlackBuild script from /extra but my main concern is why scripts form /etc/profile.d are not sourced automatically in Docker container.
 
Old 11-30-2016, 08:56 AM   #4
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by janas03 View Post
Thank you for your effort tronayne. I built Java package using the SlackBuild script from /extra but my main concern is why scripts form /etc/profile.d are not sourced automatically in Docker container.
If I had to guess (I've never used docker), I'd say it is likely related to login shells vs non-login shells. Login shells will run /etc/profile, which in turn will run all executable scripts in /etc/profile.d/, which includes the file that sets the java environment; it will also run your ~/.profile (if it exists). Non login shells will only read from your .bashrc, which if you want it to load everything, you should have it source /etc/profile.

You could also just have it run /etc/profile.d/jdk.sh directly in your .bashrc to just load that environment.
 
2 members found this post helpful.
Old 11-30-2016, 09:22 AM   #5
janas03
LQ Newbie
 
Registered: Apr 2008
Location: Warsaw, Poland
Distribution: Slackware64 14.2
Posts: 29

Original Poster
Rep: Reputation: 4
@bassmadrigal bingo! Modifying entrypoint so that it has -l parameter makes bash act as if it was invoked as login shell and sources all needed files. This also solves sourcing lang.sh problem.
 
1 members found this post helpful.
  


Reply

Tags
docker, slackware


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Oracle Puts OpenStack Into Docker Containers LXer Syndicated Linux News 0 10-22-2015 01:32 PM
LXer: How to install Oracle JRE on Fedora 20 and use alternatives to switch between it and OpenJDK LXer Syndicated Linux News 0 09-20-2014 06:01 PM
Latest Oracle Java JDK/JRE l0rddarkf0rce Slackware 26 06-09-2013 03:48 AM
GLIBC_2.0 Error When installing Oracle 8i OR 9i - Possibly related to JRE 1.1.8 itfcfan Linux - Software 1 05-26-2004 08:43 AM
GLIBC_2.0 Error When installing Oracle 8i OR 9i - Possibly related to JRE 1.1.8 itfcfan Mandriva 5 04-23-2004 11:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration