Andrew Andrew - 3 months ago 39
Python Question

Trying to run Cloudera Image in Docker

I am trying to run cloudera/clusterdock in a docker image for a university project. This is my first time using docker and so far I have been using the instructions on the cloudera website which are a little sparse.

I successfully downloaded docker and the cloudera image and when I run the

docker-images
command I get the following:

REPOSITORY TAG IMAGE ID CREATED SIZE
cloudera/clusterdock latest 9b4d4f1dda22 7 days ago 467.5 MB


When I try and run up the container with this image. Using the following command

docker run cloudera/clusterdock:latest /bin/bash


I get the following message

File "/bin/bash", line 1
SyntaxError: Non-ASCII character '\x80' in file /bin/bash on line 2,
but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


Having read the pep mentioned pep I know I need to change the encoding in a file but the pep concentrates on python files and I am unaware of having a python file so have no idea where to find it to correct it. Also, having limited knowledge I am uneasy changing the bin/bash file as I know it can affect your machine.

Any help will have to assume I have little knowledge of this as I have little experience.

Answer

If you look at Dockerfile for cloudera/clusterdock:latest, you can see:

ENTRYPOINT ["python"]

So, when you do docker run cloudera/clusterdock:latest /bin/bash, you are basically doing python /bin/bash inside the container. You will see the same error if you type that in your terminal, normally:

$ python /bin/bash
  File "/bin/bash", line 1
SyntaxError: Non-ASCII character '\xe0' in file /bin/bash on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

You probably wanted to do:

docker run -it --entrypoint=/bin/bash cloudera/clusterdock:latest

Look at clusterdock.sh to see how actually the container is supposed to be run.