Giter Club home page Giter Club logo

dockerbook-code's People

Contributors

dependabot[bot] avatar dexterthedragon avatar eshamow avatar gswallow avatar hajowieland avatar jamtur01 avatar legrandin avatar pschuermann avatar tarivs avatar telepenin avatar topalovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dockerbook-code's Issues

cannot load such file app issue

I build sinatra image as per dockerfile and run sinatra but failed.
what do I miss? below is error log

docker logs -f webapp
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- app (LoadError) from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from /opt/webapp/bin/webapp:5:in <main>' /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- app (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /opt/webapp/bin/webapp:5:in

'

Printing error

There is a printing error on my Chinese edition of this book, the volume path in the Dockerfile on page 134 is incorrect, and the first slack is missing in the line VOLUME /var/www/html

nodejs container fails based on nodejs image

Book version: v18.03.1-ce

When generating the nodejs image on Chapter 6: Building services with Docker, based on the book snippet, the nodejs version installed is 4.
the express app don't run on it.

Current book snippet

FROM ubuntu:16.04
LABEL maintainer="[email protected]"
ENV REFRESHED_AT 2016-06-01
RUN apt-get -yqq update
RUN apt-get -yqq install nodejs npm
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN mkdir -p /var/log/nodeapp
ADD nodeapp /opt/nodeapp/
WORKDIR /opt/nodeapp
RUN npm install
VOLUME [ "/var/log/nodeapp" ]
EXPOSE 3000
ENTRYPOINT [ "nodejs", "server.js" ]

To run the app container, I had to update node version to 10

My Dockerfile update

FROM ubuntu:16.04
LABEL maintainer="[email protected]"
ENV REFRESHED_AT 2018-12-02

RUN apt-get -yqq update
RUN apt-get -yqq install curl build-essential
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
# nodejs package already includes npm
RUN apt-get install -y nodejs

# check node version
RUN echo $(nodejs -v)
# Create logs folder
RUN mkdir -p /var/log/nodeapp
# Add our local nodeapp folder to opt
ADD nodeapp /opt/nodeapp/
# use opt path as our working directory
WORKDIR /opt/nodeapp/
# install app dependencies
RUN npm install
# map the logs folder to a persistent volume in the host machine
VOLUME [ "/var/log/nodeapp" ]
# expose express app port
EXPOSE 3000
# fire-up node app
ENTRYPOINT [ "nodejs", "server.js" ]

Errors like "debconf: unable to initialize frontend: Dialog" appear if ENV DEBIAN_FRONTEND noninteractive is not set

Hi,

Without using ENV DEBIAN_FRONTEND noninteractive in Dockerfile, the build process spews out messages like:

debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:

I don't see any Dockerfile with the 'ENV DEBIAN_FRONTEND noninteractive' line. Is this something to include in the Dockerfile, James?

the correct .dockerignore / loading of context

Hi James,

I am making a mistake somewhere I don't understand and perhaps there is a valuable lesson to be taught in book as while investigating this issue I have noticed it is quite common for .dockerignore to trip up newcomers.

I have been trying out installs on different machines trying to get the docker flow down using identical code base for practice

And with an initial build I found the follow problem with uploading the build context.

machine one - problem build see the large context 747 MB (box had previously built other images and containers)

vagrant@vagrant-ubuntu-trusty-64:/host/services/src$ docker build -t drmg/services .
Uploading context 747 MB
Uploading context
Step 0 : FROM dockerfile/nodejs
Pulling repository dockerfile/nodejs
2014/11/01 16:33:39 Get https://index.docker.io/v1/repositories/dockerfile/nodejs/images: dial tcp: lookup index.docker.io on 10.0.2.3:53: no answer from server
vagrant@vagrant-ubuntu-trusty-64:/host/services/src$ docker build -t drmg/services .
^Cvagrant@vagrant-ubuntu-trusty-64:/host/services/src$ sudo docker build -t drmg/services .

machine two - no problems only 575 kB on a fresh install

vagrant@ubuntu:src master % sudo docker build -t drmg/backend .
Sending build context to Docker daemon 575 kB
Sending build context to Docker daemon
Step 0 : FROM dockerfile/nodejs
Pulling repository dockerfile/nodejs
9a76e1635147: Pulling dependent layers

This is not the first time this has happened as was performing builds fine the other day with fig then got where nothing was happening. I ended up thinking the problem was with fig so switched to specifically building an image first then referencing that image in fig.

The only difference in machines was that on machine one I had followed through the following tutorial prior to the build so there were a few images already on the system. While machine two was completely fresh.

https://github.com/nearform/nscale/wiki/Vagrant-Rapid-Start-Guide

I think I am doing something wrong with dockerfile and fig.yml and should be loading source in fig.yml but still don't understand why the sizes of context should be different?

You can find the Dockerfile, fig and .dockerignore here

https://github.com/stackmates/common.services/tree/master/src

I have not been as attentive to setup as I could have been but attempting to be more thorough to describe each step I take with building boxes below to try to uncover the exact circumstance of how and when this happens.

https://github.com/stackmates/stackmates/tree/master/boxes

Best regards

Matt

oci runtime error: exec: " nginx": executable file not found

Docker Version 1.12.1 (build: 12133)
OSX Version 10.11.5 (15F34)

When running :

docker run -d -p 80 --name static_web jamtur01/static_web \ nginx -g "daemon off;"

As written on page 96 from Version: v1.12.2 (51305ad)

I get this message :

docker: Error response from daemon: oci runtime error: exec: " nginx": executable file not found in $PATH.

I tried several variations, but no luck...

Listing 5.70 - Running Docker-Jenkins image

Hi,

I am a Mac user and currently following the code on Chapter 5. I have built the Jenkins image, however when I run the container with the following, it returns the container ID and exits.
According to the instruction, I created jenkins_home in /private/var/jenkins_home. I also granted permission to the folder as follows; sudo chown -R 1000 /private/var/jenkins_home
Then I ran the image as follows;

docker run -d -p 8080:8080 -p 50000:50000 -v /private/var/jenkins_home:/var/jenkins_home -v /private/var/run/docker.sock:/var/run/docker.sock --name jenkins stevepop/jenkins

It returns the container ID but when I run docker ps, nothing displays. When I ran docker ps -a, I see the following;

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
decb7004b6fb        stevepop/jenkins    "/bin/tini -- /usr..."   4 seconds ago       Exited (1) 3 seconds ago                       jenkins

I suspect strongly that the problem is the volume mapping. When I remove the volumes, the container runs fine.

What could be the problem here please?

"Cannot connect to the Docker daemon" after restarting Jenkins docker container

While following along with section 6.3 "Using Docker for continuous integration" of the book, I setup and ran successfully both the Jenkins Freestyle task 'Docker_test_job' and the Multi-configuration task 'Docker_matrix_job'.

I then stopped the container & restarted my mac. I then wanted to show a colleague so i started the Jenkins container but when i ran both tasks they started failing with ""Cannot connect to the Docker daemon. Is 'docker -d' running on this host?".

I tried varies things but couldn't get around it apart from deleting the container and recreating it and resetting up Jenkins. The builds then worked fine. I stopped the container and started it again and again the builds started failing with the same message.

Now i'm not sure if this a user-error, Docker version (using 1.5), boot2docker (1.5.0) on OSX 10.10.2 or Docker-in-Docker problem or a combination. It seems that the Jenkins task can access the Docker client (i temporarily added docker -v to the shell script to check) but not the Docker daemon. Not sure why. It is probably not worth spending a lot of time investigating this but i thought i'd log it in case it somehow saved someone some time.

Here is the full console output from the Jenkins task:

Building in workspace /tmp/jenkins-buildenv/Docker_test_job/workspace

> git rev-parse --is-inside-work-tree # timeout=10
> Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/jamtur01/docker-jenkins-sample.git # timeout=10
> Fetching upstream changes from https://github.com/jamtur01/docker-jenkins-sample.git
> git --version # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/jamtur01/docker-jenkins-sample.git +refs/heads/_:refs/remotes/origin/_
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
> Checking out Revision e4830a7c4a17b2614aee8c158ecd5da434c4412c (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f e4830a7c4a17b2614aee8c158ecd5da434c4412c
> git rev-list e4830a7c4a17b2614aee8c158ecd5da434c4412c # timeout=10
> [workspace] $ /bin/sh -xe /tmp/hudson2769868839445177006.sh
> - docker build .
> - tail -1
> - awk { print $NF }
>   time="2015-02-23T22:35:52Z" level="fatal" msg="Cannot connect to the Docker daemon. Is 'docker -d' running on this host?" 
> - IMAGE=
> - MNT=/tmp/jenkins-buildenv/Docker_test_job/workspace/..
> - docker run -d -v /tmp/jenkins-buildenv/Docker_test_job/workspace/..:/opt/project 
>   /bin/bash -c cd /opt/project/workspace && rake spec
>   time="2015-02-23T22:35:53Z" level="fatal" msg="Cannot connect to the Docker daemon. Is 'docker -d' running on this host?" 
> - CONTAINER=
>   Build step 'Execute shell' marked build as failure
>   Recording test results
>   Finished: FAILURE```

Permission denied @ dir_initialize

[root@localhost jekyll]# docker run -i -t -v /root/docker-root/james_blog:/data --name james_blog zeek/jekyll
Configuration file: none
Source: /data
Destination: /var/www/html
Generating...
jekyll 2.5.3 | Error: Permission denied @ dir_initialize - .

Redis daemonized containers cannot see each other.

I am unable to run the redis-nodejs example because the daemonized containers cannot see each other: redis_replica errors with:

[10] 19 Sep 15:57:21.915 * Connecting to MASTER redis-master:6379
[10] 19 Sep 15:57:20.913 # Unable to connect to MASTER: No such file or directory

By narrowing down the case, I have eventually found out that on my laptop daemonized containers (i.e. launched with -d) cannot ever see each other. Interactive containers (i.e. launched with -ti) can.

All container have their IP neatly configured and visible with sudo docker network inspect express; therefore I can attach a daemonized container, start a shell on it and update manually its /etc/hosts. After that everything is hunky dory, but of course this is not a passable solution in the real world.

Did I encounter a problem due to a new version of the networking software?

Is there something wrong with my Docker installation? It is plain 1.12.1, build 23cf638.

Please assist. Thank you.

Error occur while build in jenkins

Error in jenkins in section 5.3:
Console output Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? after run sudo docker build . or docker build .
The script dockerjenkins.sh seems useless now as there is none entrypoint in Dockerfile.

Actually I don't understand how you get success in the screenshot in the book.

Error in `docker run redis`

Error in Section 5.2.3.2 [Building a Redis database image].

This is the Dockerfile for Redis image.

FROM ubuntu:16.04
MAINTAINER James Turnbull "[email protected]"
ENV REFRESHED_AT 2016-06-01
RUN apt-get -yqq update; apt-get -yqq install redis-server redis-tools
EXPOSE 6379
ENTRYPOINT [ "/usr/bin/redis-server", "--protected-mode no" ]
CMD []

and This is the command for building and running Redis image.

$ docker build -t jamtur01/redis .
$ docker run -d -p 6379 --name redis jamtur01/redis

This command occurs the following error.

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 2
>>> 'protected-mode " no"'
Bad directive or wrong number of arguments

I'm studying Docker with The Docker Book and new to Redis.
How can I debug it.

6.1.1 docker build fail

FROM ubuntu:16.04
MAINTAINER James Turnbull <[email protected]>
ENV REFRESHED_AT 2016-06-01

RUN apt-get -qq update
RUN apt-get -qq install ruby ruby-dev build-essential nodejs
RUN gem install --no-rdoc --no-ri jekyll -v 2.5.3

VOLUME /data
VOLUME /var/www/html
WORKDIR /data

ENTRYPOINT [ "jekyll", "build", "--destination=/var/www/html" ]

it should be modify the follow file:

FROM ubuntu:16.04
MAINTAINER James Turnbull <[email protected]>
ENV REFRESHED_AT 2016-06-01

RUN apt-get -qq update
RUN apt-get -qq install ruby ruby-dev libffi-dev build-essential nodejs
RUN gem install ffi  jekyll

VOLUME /data
VOLUME /var/www/html
WORKDIR /data

ENTRYPOINT [ "jekyll", "build", "--destination=/var/www/html" ]

the error message is:

Successfully installed sawyer-0.8.1
Successfully installed octokit-4.8.0
Successfully installed jekyll-gist-1.5.0
Successfully installed coffee-script-source-1.11.1
Successfully installed execjs-2.7.0
Successfully installed coffee-script-2.4.1
Successfully installed jekyll-coffeescript-1.1.1
Successfully installed rb-fsevent-0.10.2
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20180207-5-pvlqbe.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.21/mkmf.log

current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR=" clean

current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR="
Running autoreconf for libffi
/var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c/libffi/autogen.sh: 2: exec: autoreconf: not found
libffi.mk:6: recipe for target '"/var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux-gnu"/.libs/libffi_convenience.a' failed
make: *** ["/var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux-gnu"/.libs/libffi_convenience.a] Error 127

make failed, exit code 2

Code list 7-30 correction

The command below in Code list 7-30 doesn't work on my VM.

 PUBLIC_IP="$(ifconfig eth0 | awk -F ' *|:' '/inet addr/{print $4}')"

so I corrected it as following:

PUBLIC_IP="$(ifconfig eth1 | awk -F ' *|:' '/inet/{print $3}')"

My OS is CentOS 7.1:

[root@sv consul]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.1.1503 (Core)
Release: 7.1.1503
Codename: Core

Error in Chapter 5 Jenkins Dockerfile

I received the following error when trying to build Jenkins in chapter 5.

 "E: The method driver /usr/lib/apt/methods/http could not be found."

To fix this error I added the following to my build script:

RUN apt-get -y install apt-transport-https

Chapter 5 Jenkins example failed on installing ca and certificates

Hey,

First of all, it is a great book. It worths every penny and I really really enjoy it. Thank you for putting a great list of Docker together for the beginners.

In chapter 5, testing with Docker. PDF page 172 of 301, version 1.1.1 (76fbc4e). I tried with docker build on the Dockerfile. It failed at

RUN apt-get update -qq && apt-get install -qqy iptables ca certificates lxc openjdk-6-jdk git-core lxc-docker

So I followed the debugging technique and docker run bashed into a last successful state of the image. I run apt-get install ca, apt-get install certificates. I got the error below

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ca

It was the same error when do the docker build, the apt-get have been successfully updated. What was the different between my system and yours? i am running Docker version 1.2.0, build fa7b24f

jekyll container won't pick up configuration file

I am running docker inside vagrant (phusion 14) and can't get the container to pass the right directory

I have tried altering volume to have different paths and moved contents of blog to different locations and tried various way to name inputs.

But when I look into volume directory it is empty... I must be doing something stupid but I can't see it.

docker run -v $PWD/james_blog:/data/ --name james_blog stackmates/jekyll
Configuration file: none
Source: /data
Destination: /var/www/html
Generating...
done.

FROM ubuntu:14.04
MAINTAINER Matt Mischewski [email protected]

RUN apt-get -yqq update
RUN apt-get -yqq install ruby ruby-dev make nodejs
RUN gem install --no-rdoc --no-ri jekyll

VOLUME [ "/data/", "/var/www/html/" ]
WORKDIR /data

ENTRYPOINT [ "jekyll", "build", "--destination=/var/www/html" ]

gem of tprov does not work

In 6.2.5
The gem installed by command sudo gem install -no-rdoc --no-ri tprov does not work correctly, but the gem I built from the code here works well, the file app.rb is different, it seems that you didn't update the gem on server.
qq20150325-1 2x

Finally, in the Dockerfile of 6.2.1, the latest version of wget does not have the option -?, it should be '-h' .

replica does not connect to primary using hostname

I built the redis cluster and used docker version 1.13 (newest kindle ebook edition).

project:
The redis_replica Dockerfile contains the line --slaveof redis-primary 6379 in order to connect to redis_primary.
You explicitly mention that hostnames may not contain underscores _ that's why you call it redis-primary instead of redis_primary which is the name of the image itself.

problem:
In my setup, the redis_replica container does not find redis_primary using the hostname redis-primary.
I had to change the line
--slaveof redis-primary 6379
to
--slaveof redis_primary 6379
using the container name redis_primary rather than the hostname redis-primary.

You mentioned some tiny bit about DNS, but nothing specifically.
Did you edit your host file or some container's host file anywhere, maybe I missed that point reading the book.

Do you have any advice?
Thanks.

6.33 node-gyp rebuild err

Step 10/13 : RUN npm install
---> Running in e25094fee94a

[email protected] install /opt/nodeapp/node_modules/hiredis
node-gyp rebuild

/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:354:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.10.0-957.21.3.el7.x86_64
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /opt/nodeapp/node_modules/hiredis
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
[email protected] /opt/nodeapp
+-- [email protected]
| +-- [email protected]
| | -- [email protected] | -- [email protected]
| +-- [email protected]
| +-- [email protected]
| -- [email protected] +-- [email protected] | +-- [email protected] | -- [email protected]
+-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | -- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | +-- [email protected] | | | +-- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | -- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | | -- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| -- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| -- [email protected] | -- [email protected]
+-- [email protected]
| +-- [email protected]
| -- [email protected] | -- [email protected]
`-- [email protected]

npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! Linux 3.10.0-957.21.3.el7.x86_64
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hiredis package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hiredis
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hiredis
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /opt/nodeapp/npm-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1

When i click submit war to tprov getting connection refused error

Excon::Errors::SocketError - Connection refused - connect(2) (Errno::ECONNREFUSED):
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/socket.rb:142:in connect_nonblock' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/socket.rb:142:inrescue in block in connect'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/socket.rb:119:in block in connect' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/socket.rb:110:ineach'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/socket.rb:110:in connect' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/ssl_socket.rb:148:inconnect'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/socket.rb:28:in initialize' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/ssl_socket.rb:8:ininitialize'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:387:in new' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:387:insocket'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:106:in request_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/mock.rb:47:inrequest_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/instrumentor.rb:22:in request_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:15:inrequest_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:15:in request_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:15:inrequest_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:15:in request_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:233:inrequest'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/idempotent.rb:26:in error_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:inerror_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in error_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:inerror_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:256:in rescue in request' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:204:inrequest'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/idempotent.rb:26:in error_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:inerror_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in error_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:inerror_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:256:in rescue in request' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:204:inrequest'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/idempotent.rb:26:in error_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:inerror_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:in error_call' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/middlewares/base.rb:10:inerror_call'
/var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:256:in rescue in request' /var/lib/gems/1.9.1/gems/excon-0.45.4/lib/excon/connection.rb:204:inrequest'
/var/lib/gems/1.9.1/gems/docker-api-1.25.0/lib/docker/connection.rb:40:in request' /var/lib/gems/1.9.1/gems/docker-api-1.25.0/lib/docker/connection.rb:65:inblock (2 levels) in class:Connection'
/var/lib/gems/1.9.1/gems/docker-api-1.25.0/lib/docker/container.rb:291:in all' /var/lib/gems/1.9.1/gems/tprov-0.0.5/lib/tprov/app.rb:87:inlist_instances'
/var/lib/gems/1.9.1/gems/tprov-0.0.5/lib/tprov/app.rb:63:in block in <class:Application>' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:incall'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in block in compile!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in[]'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in block (3 levels) in route!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:993:inroute_eval'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in block (2 levels) in route!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:inblock in process_route'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in catch' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:inprocess_route'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:972:in block in route!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:ineach'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in route!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1084:inblock in dispatch!'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in block in invoke' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:incatch'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in invoke' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:indispatch!'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in block in call!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:inblock in invoke'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in catch' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:ininvoke'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in call!' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:incall'
/var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in call' /var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:incall'
/var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in call' /var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:incall'
/var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in call' /var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:incall'
/var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in call' /var/lib/gems/1.9.1/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:incall'
/var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in context' /var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:incall'
/var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/logger.rb:15:in call' /var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/commonlogger.rb:33:incall'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in call' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:211:incall'
/var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/head.rb:13:in call' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/show_exceptions.rb:21:incall'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in call' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:incall'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in block in call' /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:insynchronize'
/var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in call' /var/lib/gems/1.9.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:inservice'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in service' /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:inrun'

Chapter 5.3.3. Jenkins build creates spec/reports as root; causing subsequent builds to fail

Just wanted to post this in case somebody had the same issue.
As the description indicates, I get the following error in Jenkins (this is the relevant part):

...

hudson.plugins.git.GitException: Command "git checkout -f e8699fc5501b124fe2330c7f2f03ff0e08d64276" returned status code 128:
stdout: 
stderr: fatal: cannot unlink 'spec/reports/SPEC-These-are-sample-RSpec-tests.255.xml': Permission denied

...

Because the directory spec/reports/ is being created as root:

jenkins@ec3cb26d902b:~/jobs/Docker_test_job/workspace/spec$ ls -l
total 40
drwxr-xr-x 2 root    root    36864 Jul 26 02:23 reports
-rw-r--r-- 1 jenkins jenkins   110 Jul 26 01:37 sample_spec.rb

I managed to solve it by changing the following line in the execute shell in Jenkins, appending ; chown -R 1000 spec/reports (although I had to run chown manually the first time; also, removing the directory with sudo works too):

# Execute the build inside Docker.
CONTAINER=$(sudo docker run -d -v $MNT:/opt/project/ $IMAGE /bin/bash -c 'cd /opt/project/workspace && rake spec; chown -R 1000 spec/reports')

After that, the subsequent builds work fine. Don't know if there's a better way to deal with this. I assume this problem is caused by the temp container being run as root, but I'm still learning Docker, after all, so I'm not sure.

Thanks;

Cannot load Calendar.war into container created by TProv

WAR is downloaded from:

https://code.google.com/archive/p/gwt-examples/downloads/Calendar.war

and by inspection it seems ok.

Please verify and confirm/deny.

Logs of the tomcat7 container tell the following:

INFO: Starting Servlet Engine: Apache Tomcat/7.0.68 (Ubuntu)
Sep 19, 2016 7:11:47 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/Calendar.war
Sep 19, 2016 7:11:47 AM org.apache.catalina.startup.ContextConfig beforeStart
SEVERE: Exception fixing docBase for context [/Calendar]
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:219)
    at java.util.zip.ZipFile.<init>(ZipFile.java:149)
    at java.util.jar.JarFile.<init>(JarFile.java:166)
    at java.util.jar.JarFile.<init>(JarFile.java:103)
    at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:99)
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
    at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
    at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:111)
    at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:735)
    at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:863)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:144)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Sep 19, 2016 7:11:47 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file
    at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.java:137)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5197)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5386)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Sep 19, 2016 7:11:47 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Calendar]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Error in resourceStart()
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5387)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    ... 10 more

Sep 19, 2016 7:11:47 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /var/lib/tomcat7/webapps/Calendar.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Calendar]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:903)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Sep 19, 2016 7:11:47 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/tomcat7/webapps/Calendar.war has finished in 44 ms
Sep 19, 2016 7:11:47 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 19, 2016 7:11:47 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 93 ms

redis protected mode

Change Dockerfile as follows:
ENTRYPOINT ["/usr/bin/redis-server","--protected-mode no" ]

unable to locate package tomcat7

In chapter, when build tomcat7, unable to locate package tomcat7

Step 1/14 : FROM ubuntu:18.04
 ---> 47b19964fb50
Step 2/14 : MAINTAINER 
 ---> Using cache
 ---> 1b8cd62dfcd1
Step 3/14 : ENV freshed_at 2019-03-14
 ---> Using cache
 ---> e9d521c19bbb
Step 4/14 : RUN apt-get -qq update
 ---> Using cache
 ---> 64f89f7b9605
Step 5/14 : RUN apt-get -qq install tomcat7 default-jdk
 ---> Running in 6e473c92c9c5
E: Unable to locate package tomcat7
The command '/bin/sh -c apt-get -qq install tomcat7 default-jdk' returned a non-zero code: 100

Error in Chapter 6 about jekyll container start

$docker run -v /home/docker/the_docker_book/jekyll/james_blog:/data/
@iZ25r06n0jfZ > --name james_blog jekyll
DEPRECATION WARNING:
Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.

Configuration file: /data/_config.yml
Source: /data
Destination: /var/www/html
Generating...
Build Warning: Layout 'nil' requested in atom.xml does not exist.

I have no experience of ruby , anybody could tell me how to solve ?

Error starting redis on Mac

I'm using version 17.03.0 of the Docker Book, on a Mac. In Chapter 5, in the section Building a Redis database image, on page 160 I'm getting an error when starting the redis container.

Here is my Dockerfile:

FROM ubuntu:16.04
ENV REFRESHED_AT 2017-04-06
RUN apt-get -yqq update; apt-get -yqq install redis-server redis-tools
EXPOSE 6379
ENTRYPOINT ["/usr/bin/redis-server", "--protected-mode no" ] 
CMD []

The docker image builds successfully, when I try to run it, the container starts and then exits immediately. docker logs shows:

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 2
>>> 'protected-mode no'
Bad directive or wrong number of arguments

I'm guessing this is a redis issue.

wget commands to github fail - Chapter 5, listings 5.18

When using wget as shown in figure 5.18 and similar, the bottom dirs (bin and lib) are downloaded as single files instead of being recursed into.

Script started on 2020-07-12 19:08:37+00:00
tom@docker-herder:~/git-work/docker-book/sinatra$ pwd
/home/tom/git-work/docker-book/sinatra
tom@docker-herder: ~/git-work/docker-book/sinatra$ ls -l
total 4
-rw-rw-r-- 1 tom tom 294 Jul 12 14:55 Dockerfile
-rw-rw-r-- 1 tom tom 0 Jul 12 19:08 typescript
tom@docker-herder: ~/git-work/docker-book/sinatra$ wget --cut-dirs=7 -nH -r -e robots=off --reject="index.html","Dockerfile" --no-parent https://github.com/turnbullpress/dockerbook-code/tree/master/code/5/sinatra/webapp
--2020-07-12 19:08:50-- https://github.com/turnbullpress/dockerbook-code/tree/master/code/5/sinatra/webapp
Resolving github.com (github.com)... 140.82.114.3
Connecting to github.com (github.com)|140.82.114.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘webapp’
webapp
2020-07-12 19:08:50 (448 KB/s) - ‘webapp’ saved [75941]

--2020-07-12 19:08:50-- https://github.com/turnbullpress/dockerbook-code/tree/master/code/5/sinatra/webapp/bin
Reusing existing connection to github.com:443.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘webapp/bin’
webapp/bin
2020-07-12 19:08:51 (881 KB/s) - ‘webapp/bin’ saved [73756]

--2020-07-12 19:08:51-- https://github.com/turnbullpress/dockerbook-code/tree/master/code/5/sinatra/webapp/lib
Reusing existing connection to github.com:443.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘webapp/lib’
webapp/lib
2020-07-12 19:08:51 (5.71 MB/s) - ‘webapp/lib’ saved [73888]

FINISHED --2020-07-12 19:08:51--
Total wall clock time: 1.5s
Downloaded: 3 files, 218K in 0.3s (841 KB/s)
tom@docker-herder: ~/git-work/docker-book/sinatra$ ls -lR
.:
total 8
-rw-rw-r-- 1 tom tom 294 Jul 12 14:55 Dockerfile
-rw-rw-r-- 1 tom tom 0 Jul 12 19:08 typescript
drwxrwxr-x 2 tom tom 4096 Jul 12 19:08 webapp

./webapp:
total 152
-rw-rw-r-- 1 tom tom 73756 Jul 12 19:08 bin
-rw-rw-r-- 1 tom tom 73888 Jul 12 19:08 lib
tom@docker-herder: ~/git-work/docker-book/sinatra$ file webapp
webapp/: directory
tom@docker-herder: ~/git-work/docker-book/sinatra$ file webapp/lib
webapp/lib: HTML document, UTF-8 Unicode text, with very long lines

Script done on 2020-07-12 19:09:18+00:00

Can not run build on Jenkins

Hi,

After successfully create container jenkins with your config, I tried to build my first job but the build failed with error: sudo: not found

Full logs:

Started by user admin
Building in workspace /var/jenkins_home/jobs/Docker_test_job/workspace
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/jamtur01/docker-jenkins-sample.git # timeout=10
Fetching upstream changes from https://github.com/jamtur01/docker-jenkins-sample.git
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress https://github.com/jamtur01/docker-jenkins-sample.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 82216cfafe447662b00832d4a4aca83413cb87fd (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 82216cfafe447662b00832d4a4aca83413cb87fd
 > git rev-list 82216cfafe447662b00832d4a4aca83413cb87fd # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson5749425719159912621.sh
+ sudo docker build .
/tmp/hudson5749425719159912621.sh: 3: /tmp/hudson5749425719159912621.sh: sudo: not found
+ tail -1
+ awk { print $NF }
+ IMAGE=
+ MNT=/var/jenkins_home/jobs/Docker_test_job/workspace/..
+ sudo docker run -d -v /var/jenkins_home/jobs/Docker_test_job/workspace/..:/opt/project/ /bin/bash -c cd /opt/project/workspace && rake spec
/tmp/hudson5749425719159912621.sh: 9: /tmp/hudson5749425719159912621.sh: sudo: not found
+ CONTAINER=
Build step 'Execute shell' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE

docker run -d -p 4567 xxxxThe result is success

Dockerfile content

FROM ubuntu:18.04
LABEL MAINTAINER="[email protected]"
ENV REFRESHED_AT 2019-01-08

RUN apt-get -qq update && apt-get -qq install ruby ruby-dev build-essential redis-tools
RUN gem install --no-rdoc --no-ri sinatra json redis

RUN mkdir -p /opt/webapp

EXPOSE 4567

CMD [ "/opt/webapp/bin/webapp" ]

when I look docker logs is fail

[docker@al_first sinatra]$ docker run -d -p 4567 --name webapp -v $PWD/webapp:/opt/webapp alzerot/sinatra 
fdf09145e8ecea477c292dbd741430259410befd1026e23f6cf582fd7c66583c
[docker@al_first sinatra]$ docker ps 
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
97072c9adcde        alzerot/nginx       "nginx"                  11 hours ago        Up 11 hours         0.0.0.0:32768->80/tcp    website
3ddccfbbf41c        registry            "/entrypoint.sh /e..."   22 hours ago        Up 22 hours         0.0.0.0:5000->5000/tcp   pensive_edison
[docker@al_first sinatra]$ docker logs webapp
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': /opt/webapp/lib/app.rb:16: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
	from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	from /opt/webapp/bin/webapp:5:in `<main>'

But I don't know how to solve it
This is my directory

 [docker@al_first sinatra]$ ll
total 8
-rw-rw-r-- 1 docker docker  297 Jan  8 09:54 Dockerfile
drwxrwxr-x 4 docker docker 4096 Jan  7 23:12 webapp
[docker@al_first sinatra]$ cd webapp/
[docker@al_first webapp]$ ll
total 8
drwxrwxr-x 2 docker docker 4096 Jan  7 23:15 bin
drwxrwxr-x 2 docker docker 4096 Jan  7 23:15 lib
[docker@al_first webapp]$ cd bin/
[docker@al_first bin]$ ll
total 4
-rwxrwxr-x 1 docker docker 119 Jan  7 23:02 webapp
[docker@al_first bin]$ cd ..
[docker@al_first webapp]$ cd lib
[docker@al_first lib]$ ll
total 4
-rw-rw-r-- 1 docker docker 218 Jan  7 23:03 app.rb

Running jenkins on OSX

I could not get the example code on p182 to work on mac OSX 10.12.3 (16D32)

changed instructions From

sudo mkdir -p /var/jenkins_home
cd /var/jenkins_home
sudo chown -R 1000 /var/jenkins_home

sudo docker run -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock --name jenkins jamtur01/jenkins

to


sudo mkdir -p /private/var/jenkins_home
cd /private/var/jenkins_home
sudo chown -R 1000 /private/var/jenkins_home

sudo docker run -d -p 8080:8080 -p 50000:50000 -v /private/var/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock --name jenkins jamtur01/jenkins

How to update Dockerbook

I bought Dockerbook in November'16.
There is Unlimited updates options on the Dockerbook website.
Hot to update the book (get a new version)?

Sinatra version issue

The code at https://github.com/turnbullpress/dockerbook-code/blob/master/code/5/sinatra/webapp/Dockerfile#L6
and https://github.com/turnbullpress/dockerbook-code/blob/master/code/5/sinatra/webapp_redis/Dockerfile#L6 can't progress.

#6 1.939 ERROR:  Error installing sinatra:                                      
#6 1.939        There are no versions of mustermann (~> 3.0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?                                                                         
#6 1.939 	mustermann requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

According https://github.com/sinatra/sinatra/blob/master/README.md?plain=1#L2828

Versions of Ruby before 2.6 are no longer supported as of Sinatra 3.0.0.

But the version of ruby on apt is 2.5.0, and sinatra version on gem is 3.0.2, so it's a conflict.

It's better to give a specific version to sinatra. (2.2.2 was latest supporting Ruby 2.5)

Jenkins does not build proper, missing GIT plugin

Hi,

I just follow your latest Docker file at https://github.com/jamtur01/dockerbook-code/blob/master/code/5/jenkins/Dockerfile

FROM jenkins
MAINTAINER [email protected]
ENV REFRESHED_AT 2016-06-01

USER root
RUN wget http://get.docker.com/builds/Linux/x86_64/docker-latest.tgz
RUN tar -xvzf docker-latest.tgz
RUN mv docker/* /usr/bin/

USER jenkins
COPY plugins.txt /usr/share/jenkins/ref/
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/ref/plugins.txt

But on step Create a new Jenkins job, I couldn't find the GIT option in Source code management section. I tried to read the log from Docker when starting jenkins container and I found this line:

SEVERE: Failed to install git: One or more dependencies could not be resolved for git : scm-api (1.0)

It seems that your setup is failed to install the GIT plugin. There is also known issue in here: https://issues.jenkins-ci.org/browse/JENKINS-30361

Any help?

CI Chapter - Image getting created in Host machine

Context

I'm reading the Continuous Integration Chapter and following the Jenkins + Ruby setup. I'm able to launch Jenkins and configure & run the build. However, the build fails. Appreciate your help to understand what is going on.

Error Description

No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

Debugging attempts

` Tagged the imag as 'myapp' to see whats happening. Noticed that the image is actually getting created on the host machine & not inside the jenkins container. I'm not sure if this should the case. Having created a docker server inside Jenkins container, the image should have been created in there. Is suspect that possibly this could be the a reason for issue described above

  • Tried listing the folder contents at each step to see what the runtime is seeing & did not find anything amiss.
  • and still when the container is started up the error shown above is encountered. Details below
  • My thoughts
    • the unix port binding during startup is confusing

Container startup script

docker run -i -p 8080:8080 -p 50000:50000  -v /var/run/docker.sock:/var/run/docker.sock --name jenkins cvenkatesh/jenkins-docker-server
-- if you are wondering about the missing config folder, its deliberately skipped. I'm planning to get to it later.

Execute Shell Script

IMAGE=$(sudo docker build -t myapp . |tail -l |awk '{ print $NF }')
IMAGE=$(sudo docker images myapp -q)
MNT="/var/jenkins_home/jobs/${JOB_NAME}"
ls -l $MNT
ls -l $MNT/workspace
CONTAINER=$(sudo docker run -d -v $MNT:/opt/project -w /opt/project/workspace $IMAGE /bin/bash -c 'cd /opt/project/workspace;rake spec --trace')
sudo docker attach $CONTAINER
RC=$(sudo docker wait $CONTAINER)
sudo docker rm $CONTAINER
exit $RC

JENKINS-OUTPUT

+ MNT=/var/jenkins_home/jobs/test_build
+ ls -l /var/jenkins_home/jobs/test_build
total 16
drwxr-xr-x 46 jenkins jenkins 4096 Feb 10 10:54 builds
-rw-r--r--  1 jenkins jenkins 2011 Feb 10 10:54 config.xml
lrwxrwxrwx  1 jenkins jenkins   22 Feb 10 10:54 lastStable -> builds/lastStableBuild
lrwxrwxrwx  1 jenkins jenkins   26 Feb 10 10:54 lastSuccessful -> builds/lastSuccessfulBuild
-rw-r--r--  1 jenkins jenkins    3 Feb 10 10:54 nextBuildNumber
drwxr-xr-x  8 jenkins jenkins 4096 Feb 10 09:37 workspace
+ ls -l /var/jenkins_home/jobs/test_build/workspace
total 52
-rw-r--r-- 1 jenkins jenkins   202 Feb 10 08:57 Dockerfile
-rw-r--r-- 1 jenkins jenkins    61 Feb 10 08:57 Gemfile
-rw-r--r-- 1 jenkins jenkins   418 Feb 10 08:57 Gemfile.lock
-rw-r--r-- 1 jenkins jenkins 10273 Feb 10 08:57 LICENSE
-rw-r--r-- 1 jenkins jenkins   142 Feb 10 08:57 README.md
-rw-r--r-- 1 jenkins jenkins   265 Feb 10 08:57 Rakefile
drwxr-xr-x 2 jenkins jenkins  4096 Feb 10 08:57 centos
drwxr-xr-x 2 jenkins jenkins  4096 Feb 10 08:57 debian
drwxr-xr-x 3 root    root     4096 Feb 10 09:37 opt
drwxr-xr-x 2 jenkins jenkins  4096 Feb 10 08:57 spec
drwxr-xr-x 2 jenkins jenkins  4096 Feb 10 08:57 ubuntu
+ sudo docker run -d -v /var/jenkins_home/jobs/test_build:/opt/project -w /opt/project/workspace e7d8c91df2b0 /bin/bash -c cd /opt/project/workspace;rake spec --trace

+ CONTAINER=476087fc73cafeffed7639332c5cff7541ca89efeb2b3e5f1b168c408c4ebee0
+ sudo docker attach 476087fc73cafeffed7639332c5cff7541ca89efeb2b3e5f1b168c408c4ebee0
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/lib/ruby/vendor_ruby/rake/application.rb:684:in `raw_load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:94:in `block in load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:176:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:93:in `load_rakefile'
/usr/lib/ruby/vendor_ruby/rake/application.rb:77:in `block in run'
/usr/lib/ruby/vendor_ruby/rake/application.rb:176:in `standard_exception_handling'
/usr/lib/ruby/vendor_ruby/rake/application.rb:75:in `run'
/usr/bin/rake:27:in `<main>'
Build step 'Execute shell' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE

Images on the host machine (trimmed list)

REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
myapp                              latest              998203e99399        6 seconds ago       188MB
cvenkatesh/jenkins-docker-server   latest              1600db4417b8        6 hours ago         1.05GB
cvenkatesh/ubuntu-node-mongo       latest              586d8cfd0062        45 hours ago        562MB

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.