Watching Netflix in RHEL6 and clones

In September or so of 2014, it became possible to watch Netflix on Linux without use of wine. It works out of the box with google-chrome 37 or later. (I think--by now, most distributions have later versions, so it shouldn't matter.)

However, in RHEL6 and its clones, such as CentOS, although there are builds of google-chrome (not the open source version chromium--you need google's version of chrome) later than 37, it doesn't work. According to a thread on the CentOS list that begins here, it has to do with the older version of nss shipped with RHEL6, however, even after that was upgraded, netflix still failed. One suggestion is to use docker to run something else, as it's light on resources. It does work well, but as the documentation for it seems to be scattered, I wound up, after a few minutes of googling, using the following method. This works for me on CentOS-6.x using a Debian docker image. I got the information from a page by a docker developer, Jessie Frazelle. It doesn't run google-chrome in a sandbox, which may be a security risk, but as all I do with it is go to netflix.com to watch movies, for my needs, it's not a concern. Those familiar with docker can no doubt easily create their own solutions, but this works for me and took about 3 minutes to do.

In addition as of October, 2015, this also works with Amazon videos. As Amazon doesn't officially support Linux viewing, it is useful. It may also work with HBO's online videos, but I don't have an HBO account.

First, install docker. There's already a program called docker, which is a tray docking application, so you want to install the program called docker-io.
yum -y install docker-io

Once this is done, you have to start the service.
service docker start

Docker requires either root privilege, or that the user is a member of the docker group. If your user name is john
usermod -G docker -a john

You'll have to log out and log back in for the change to take effect.

Next, we need to get Ms.Frazelle's image for chrome (not chromium).
sudo docker pull jesse/chrome

You should see messages that it's downloading the docker image. Once this is done (the different parts of the command are explained with comments on Ms. Frazelle's page, linked above), you may need to run xhost to allow the local host.
sudo xhost + 127.0.0.1

Next, there's a long command to start it running. I just made a script, rather than typing it each time I want to watch netflix. (I _do_ do other things.)
docker run -it --net host --cpuset-cpus 0 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v $HOME/Downloads:/root/Downloads  -v /dev/snd:/dev/snd --privileged --name chrome jess/chrome

That's one line. If you didn't make yourself a member of the docker group, then it would reuquire sudo to run.

The original page has it as --cpuset 0, but if one still uses that, while it will run, one gets the error that it's deprecated and will soon be replaced by --cpuset-cpus

It opens a chrome session in which I can watch Netflix to my heart's content. When I run it, I'll get some warnings that it's not running in a sandbox, and it's not using my own chrome settings. The original command also suggests adding $HOME/.config/google-chrome, but if you do that, it will change your usual chrome settings.

When done with docker, it is necessary to remove the chrome instance. or next time you use it you'll get an error that the name chrome is already assigned to an image ID. So, when done, run
docker rm chrome