CircleCi node specified version image is different than in practice - node.js

i have the config.yaml file that specify
docker:
- image: circleci/node:9.10.1
But when connecting with ssh to the container the and running the command:
node -v
it returns 4.2.6.
The container is running on UBUNTU 14.
Is there something im missing?

Related

GitLab CI/Docker on Windows/node container - unknown network http

I'm trying to run basic pipeline that should build my web-project using GitLab CI
My setup:
GitLab CE 10.1.4 on Ubuntu 16.04
GitLab Runner 10.1.0 on Windows 10 1703 with docker executor
Docker 17.09.0-ce-win33 (13620) on same Windows machine
.gitlab-ci.yml:
image: node:latest
cache:
paths:
- node_modules/
build:
script:
- npm install
- npm run build
And I get failed build with this output:
Running with gitlab-runner 10.1.0 (c1ecf97f)
on ****** (9366a476)
Using Docker executor with image node:latest ...
Using docker image sha256:4d72396806765f67139745bb91135098acaf23ce7d627e41eb4da9c62e5d6729 for predefined container...
Pulling docker image node:latest ...
Using docker image node:latest ID=sha256:cf20b9ab2cbc1b6f76e820839ad5f296b4c9a9fd04f3e74651c16ed49943dbc4 for build container...
ERROR: Job failed (system failure): dial http: unknown network http
I've thought that problem might happen because container can't access internet, but https://hub.docker.com/r/byrnedo/alpine-curl/ curl container got the data, so I think it's not the case.
UPD:
Problem occurs when GitLab runner try to attach to container.
Problem was in GitLab CI config (config.toml), docker host.
host = "http://127.0.0.1:2375" - wrong one
should be host = "tcp://127.0.0.1:2375"

installing nodeJs version on a container, using NVM

I have a docker container which has NVM installed by default. when I try to install any version of node, or running command nvm ls-remote it fails to connect to it's server every time.
the message is:
Version '6.11.2' not found - try nvm ls-remote to browse available versions.
this error occurs just in this network I am joining to.
it is my /etc/resolve.conf file content:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
search SAD.UM.AC.IR
nameserver 8.8.8.8
nameserver 8.8.4.4
result of docker network ls command is:
NETWORK ID NAME DRIVER SCOPE
dc8cffbb2789 bridge bridge local
5efb2b5fb44e host host local
8c19a2b28c14 none null local
It is just a network problem!! Is there any thing to solve this??
Finally after a discussion with #TarunLalwani, I find what is wrong in this case. The problem is that my container does not use my host machine internet, so it has no internet access. I use this command when I run the container:
docker run -it -v somewhere/:/somewhere --net=host -p 8585:8585 --name test docker-image
--net=host added to command.

Docker how to start nodejs app with redis in the Container?

I have simple but curious question, i have based my image on nodejs image and i have installed redis on the image, now i wanted to start redis and nodejs app both running in the container when i do the docker-compose up. However i can only get one working, node always gives me an error. Does anyone has any idea to
How to start the nodejs application on the docker-compose up ?
How to start the redis running in the background in the same image/container ?
My Docker file as below.
# Set the base image to node
FROM node:0.12.13
# Update the repository and install Redis Server
RUN apt-get update && apt-get install -y redis-server libssl-dev wget curl gcc
# Expose Redis port 6379
EXPOSE 6379
# Bundle app source
COPY ./redis.conf /etc/redis.conf
EXPOSE 8400
WORKDIR /root/chat/
CMD ["node","/root/www/helloworld.js"]
ENTRYPOINT ["/usr/bin/redis-server"]
Error i get from the console logs is
[36mchat_1 | [0m[1] 18 Apr 02:27:48.003 # Fatal error, can't open config file 'node'
Docker-yml is like below
chat:
build: ./.config/etc/chat/
volumes:
- ./chat:/root/chat
expose:
- 8400
ports:
- 6379:6379
- 8400:8400
environment:
CODE_ENV: debug
MYSQL_DATABASE: xyz
MYSQL_USER: xyz
MYSQL_PASSWORD: xyz
links:
- mysql
#command: "true"
A docker file can have but one entry point(either CMD or ENTRYPOINT, not both). But, you can run multiple processes in a single docker image using a process manager like systemd. There are countless recipes for doing this all over the internet. You might use this docker image as a base:
https://github.com/million12/docker-centos-supervisor
However, I don't see why you wouldn't use docker compose to spin up a separate redis container, just like you seem to want to do with mysql. BTW where is the mysql definition in the docker-compose file you posted?
Here's an example of a compose file I use to build a node image in the current directory and spin up redis as well.
web:
build: .
ports:
- "3000:3000"
- "8001:8001"
environment:
NODE_ENV: production
REDIS_HOST: redis://db:6379
links:
- "db"
db:
image: docker.io/redis:2.8
It should work with a docker file looking like the one you have minus trying to start up redis.

Failed to start Tomcat8 server on ubuntu 12.04

Trying to install Tomcat 8 on ubuntu 12.04 but I have this following problem with Catalina component ,I think it's related to log files.
this is the command result:
~# $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE: /opt/apache-tomcat-8.0.15-src
Using CATALINA_HOME: /opt/apache-tomcat-8.0.15-src
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.15-src/temp
Using JRE_HOME: /usr/lib/jvm/default-java
Using CLASSPATH: /opt/apache-tomcat-8.0.15-src/bin/bootstrap.jar:/opt/apache-tomcat-8.0.15-src/bin/tomcat-juli.jar
touch: cannot touch `/opt/apache-tomcat-8.0.15-src/logs/catalina.out': No such file or directory
/opt/apache-tomcat-8.0.15-src/bin/catalina.sh: 399: /opt/apache-tomcat-8.0.15-src/bin/catalina.sh: cannot create /opt/apache-tomcat-8.0.15-src/logs/catalina.out: Directory nonexistent
Update:
I tried to execute the last command as sudo . This is the output:
~# sudo $CATALINA_HOME/bin/startup.sh
sudo: /etc/sudoers.d/README is mode 0777, should be 0440
Using CATALINA_BASE: /opt/apache-tomcat-8.0.15-src
Using CATALINA_HOME: /opt/apache-tomcat-8.0.15-src
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.15-src/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/apache-tomcat-8.0.15-src/bin/bootstrap.jar:/opt/apache-tomcat-8.0.15-src/bin/tomcat-juli.jar
/opt/apache-tomcat-8.0.15-src/bin/catalina.sh: 399: /opt/apache-tomcat-8.0.15-src/bin/catalina.sh: cannot create /opt/apache-tomcat-8.0.15-src/logs/catalina.out: Directory nonexistent
try to run it as sudo
sudo sh $CATALINA_HOME/bin/startup.sh
Update:
if you have installed tomcat by apt-get then you have to start it by service, try this-
sudo service tomcat start
sudo service tomcat stop

Docker failing to load apparmor profile upon ubuntu host boot

I have a container x that fails to start automatically upon host boot.
The last message in the container's log is:
set apparmor profile docker-default: no such file or directory
The same container x runs fine if I manually run "docker start x"
Any ideas on what's wrong with my environment ?
I just updated to the latest version of docker (first to 0.11.0 and now to 0.11.0) and I am experiencing the same thing on Linux Mint 15 Olivia. Installing apparmor seems to have fixed the issue:
sudo apt-get install apparmor
In case you are using fig... I was having the same issue because a wrong "volumes" entry in my fig.yml:
db:
image: postgres:9
volumes: ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
After changing it to the following code, docker could start the "db" container:
db:
image: postgres:9
volumes:
- ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
Apparently, installing apparmor is not enough, since the problem happens even with apparmor installed. More exactly, the error happens because of the docker daemon being loaded before apparmor set its config as explained here.
Full solution:
sudo apt-get install apparmor
and:
sudo service apparmor restart # Just in case
sudo service docker restart
Should work after that. At least, for me it did.

Resources