I am unable to install chef-server (chef-server-core_12.0.8-1_amd64.deb) over a docker container (Ubuntu 14.04 x86_64).
When running chef-server-ctl reconfigure it fails with following error:
Error executing action run on resource 'execute[/opt/opscode/bin/private-chef-ctl start rabbitmq]'
Mixlib::ShellOut::ShellCommandFailed
Expected process to exit with [0], but received '1'
---- Begin output of /opt/opscode/bin/private-chef-ctl start rabbitmq ----
STDOUT: warning: rabbitmq: unable to open supervise/ok: file does not exist
STDERR:
---- End output of /opt/opscode/bin/private-chef-ctl start rabbitmq ----
Ran /opt/opscode/bin/private-chef-ctl start rabbitmq returned 1
NOTE: Before starting installation , I have done following steps inside the container:
dpkg-divert --local --rename --add /sbin/initctl
ln -sf /bin/true /sbin/initctl
sysctl -w kernel.shmmax=17179869184
Is there any other work-around to get chef-server up on docker container.
Related
I am trying to use packer with GCP in gitlab-ci but every time I get to the packer build it will fail with the following error:
starting remote command: chmod +x /tmp/script_5147.sh; DEBIAN_FRONTEND='noninteractive' PACKER_BUILDER_TYPE='googlecompute' PACKER_BUILD_NAME='my_vm' /tmp/script_5147.sh
==> googlecompute.my_vm: /tmp/script_5147.sh: line 1: {message:401 Unauthorized}: command not found
2022/11/13 13:26:05 [INFO] 0 bytes written for 'stdout'
2022/11/13 13:26:05 packer-plugin-googlecompute_v1.0.16_x5.0_linux_amd64 plugin: 2022/11/13 13:26:05 [ERROR] Remote command exited with '127': chmod +x /tmp/script_5147.sh; DEBIAN_FRONTEND='noninteractive' PACKER_BUILDER_TYPE='googlecompute' PACKER_BUILD_NAME='my_vm' /tmp/script_5147.sh
2022/11/13 13:26:05 packer-plugin-googlecompute_v1.0.16_x5.0_linux_amd64 plugin: 2022/11/13 13:26:05 [INFO] RPC endpoint: Communicator ended with: 127
The script
#!/bin/bash
set -e
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt update
apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt upgrade -y iptables
# The iptables-persistent must be installed in order to create the /etc/iptables/rules.v4 file
apt install -y nginx libzmq3-dev nodejs ipset iptables-persistent net-tools libre2-dev
npm install -g yarn
rm /etc/nginx/sites-enabled/default
The packer is working locally (also with the image) and I created a VM in GCP all of them are working, only in gitlab it fails.
I created a custom image of packer and it still failed for me on gitlab.
I will try to move it to my own runner but it will take a few days for me.
Would love if someone could help me figure it out.
Ok, I figured out the problem.
I curled some files and the token was not good so when it got to packer it failed because the files were not as expected.
I printing the 401 of the curl.
My Server:
Virtual hardware: 2 vCPU / 4 Go
OS: CentOS Linux release 7.9.2009
Docker version 20.10.9
Docker Compose version 1.29.2 --> 2 installation methods
Ansible 2.9.25-1
libselinux-python3
python3-pip / pip 21.3.1
Python 2.7.5
Python 3.6.8
2 installation methods of Docker Compose:
by download from github:
# cp docker-compose-Linux-x86_64-1.29.2 /usr/local/bin/docker-compose
by PIP:
# pip3 install docker-compose --proxy "http://user:pass#proxy:port"
I try to install AWX 17.1.0 to my server.
If I use method 2 then the AWX installation works.
Otherwise if I use method 1 then AWX installation fails :
[root#myserver ~]# cp docker-compose-Linux-x86_64-1.29.2 /usr/local/bin/docker-compose
[root#myserver ~]# cd /awx-17.1.0/installer/
[root#myserver installer]# ansible-playbook -i inventory install.yml
(...)
TASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] ***
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker_compose_payload_ad5z56ir/ansible_docker_compose_payload.zip/ansible/modules/cloud/docker/docker_compose.py\", line 482, in <module>\nModuleNotFoundError: No module named 'compose'\n"}
...ignoring
TASK [local_docker : Run migrations in task container] *************************
changed: [localhost]
TASK [local_docker : Start the containers] *************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: Traceback (most recent call last):\n File \"/tmp/ansible_docker_compose_payload_1h9rln6h/ansible_docker_compose_payload.zip/ansible/modules/cloud/docker/docker_compose.py\", line 482, in <module>\nModuleNotFoundError: No module named 'compose'\n"}
(...)
I am comparing the files between the 2 methods:
By method 1 (github), 1 file only:
/usr/local/bin/docker-compose --> size : 12737304
By method 2 (pip):
/usr/local/bin/docker-compose --> size : 215
/usr/local/lib/python3.6/site-packages/compose/*
/usr/local/lib/python3.6/site-packages/docker_compose-1.29.2.dist-info/*
I don't understand why such a difference. I think this is the cause of my installation problem.
Therefore, I am looking for the way to install Docker Compose from Github as if the installation is done as per PIP.
I currently have similar images being built for virtualbox and digital ocean for dev and production (they're using packer and ansible to build). They're using Ubuntu 14.04.
I've created a docker version from the same scripts without any issue. This is going to be for a Gitlab CI environment.
When I come to install packages inside a container I get an error. Potentially to do with broken init systems? Something not running?
My initial command is /sbin/init and I've tried with and without phusion/base-image.
The error is msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'docker-engine'' failed: invoke-rc.d: unknown initscript, /etc/init.d/cgroup-lite not found.
dpkg: error processing package cgroup-lite (--configure):
(Yes, this is going to be a monolithic container rather than single-process and yes, I'm running docker from inside it - I'll be sharing docker.sock to make this work.)
So, I had a look at the code for invoke-rd.d and found this relevant snippet.
# If we're running on upstart and there's an upstart job of this name, do
# the rest with upstart instead of calling the init script.
if which initctl >/dev/null && initctl version | grep -q upstart \
&& [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
then
is_upstart=1
elif test ! -f "${INITDPREFIX}${INITSCRIPTID}" ; then
## Verifies if the given initscript ID is known
## For sysvinit, this error is critical
printerror unknown initscript, ${INITDPREFIX}${INITSCRIPTID} not found.
if [ ! -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]; then
# If the init script doesn't exist, but the upstart job does, we
# defer the error exit; we might be running in a chroot and
# policy-rc.d might say not to start the job anyway, in which case
# we don't want to exit non-zero.
exit 100
fi
fi
A combination of docker replacing the init system, the inability to use upstart in an ubuntu docker container and the ubuntu package for cgroup-lite being built for upstart meant dpkg --configure was failing as the service couldn't be started.
I am trying to deploy this Docker Gogs image to AWS.
It worked fine on my local Docker instance, but I get the following error on AWS:
Failed to build Docker image aws_beanstalk/staging-app: github.com/gogits/gogs /goroot/pkg/tool/linux_amd64/6l: running gcc failed: Cannot allocate memory [0m2015/02/15 15:09:04
The command [/bin/sh -c go get -v -tags sqlite] returned a non-zero code: 2. Check snapshot logs for details.
Add more swapfile may help.
Add file .ebextensions/01-commands.config
container_commands:
00001-add-swap:
command: '[ -f /var/swap ] || (dd if=/dev/zero of=/var/swap bs=1M count=1024 && mkswap /var/swap && swapon /var/swap)'
I have updated my distro from 13.04 to 13.10 and had a bunch of running containers. the container files are still in /var/lib/docker/container however I can not start these:
$ sudo docker start 7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65
Error: No such container: 7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65
2014/03/25 05:18:14 Error: failed to start one or more containers
$ sudo tail /var/log/upstart/docker.log
2014/03/25 05:11:19 POST /v1.10/images/create?fromImage=7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65&tag=
[/var/lib/docker|5227412d] +job pull(7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65, )
HTTP code: 404
[/var/lib/docker|5227412d] -job pull(7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65, ) = ERR (1)
2014/03/25 05:18:14 POST /v1.10/containers/7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65/start
[/var/lib/docker|5227412d] +job start(7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65)
No such container: 7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65
[/var/lib/docker|5227412d] -job start(7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65) = ERR (1)
[error] server.go:950 Error: No such container: 7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65
[error] server.go:85 HTTP Error: statusCode=404 No such container: 7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65
debug log from docker startup
[debug] runtime.go:300 Cannot load container 7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65 because it was created with another graph driver.
inspecting driver which this container was created with:
$ cd /var/lib/docker/containers/7ef2b26aa60d70d9167571dcc55502eee0c9f80ad7601bacc8a047ca1b28be65
$ cat ./config.json | grep -o Driver.*\",
Driver":"aufs","ExecDriver":"lxc-0.9.0",
is there any way to recover these?
Turns out after updating aufs was uninstalled. reinstalling like so:
sudo apt-get update
sudo apt-get install linux-image-extra-`uname -r`
fixes issue!