How can I solve the errors in apt update in raspberry pi? - raspberry-pi

Recently I edit my /etc/apt/sources.list and change jessie to stretch to get the new version of gcc-6. However I when I change stretch back to jessie, and run sudo apt-get update I got a lot of errors. How can I solve it.
pi#raspberrypi ~ $ sudo apt update
Hit:1 http://raspberrypi.collabora.com wheezy InRelease
Get:2 http://mirrordirector.raspbian.org/raspbian jessie InRelease [14.9 kB]
Err:1 http://raspberrypi.collabora.com wheezy InRelease
The following signatures were invalid: FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5
Hit:4 http://archive.raspberrypi.org/debian jessie InRelease
Get:5 http://mirrordirector.raspbian.org/raspbian jessie/main armhf Packages [9534 kB]
Hit:3 https://packagecloud.io/Hypriot/Schatzkiste/raspbian jessie InRelease
Get:6 http://124.202.164.8/files/311600000A34E137/http.debian.net/debian jessie/main armhf Packages [169 kB]
Err:6 http://124.202.164.8/files/311600000A34E137/http.debian.net/debian jessie/main armhf Packages
Writing more data than expected (196868 > 169365)
Hashes of expected file:
- Filesize:169365 [weak]
- SHA256:779179f25b91efa4fdbf69aeb7c37d444e104e3b8d359daf27bc4db4d330003f
- SHA1:aa605ce914ddacfd4b8c71c72bab3a95b76c0ed5 [weak]
- MD5Sum:f0867f34045767904d0caa686f288615 [weak]
Release file created at: Fri, 14 Jul 2017 15:58:01 +0000
Get:7 http://archive.raspbian.org/raspbian jessie InRelease [14.9 kB]
Get:8 http://archive.raspbian.org/raspbian jessie/rpi Sources [1132 B]
Get:9 http://archive.raspbian.org/raspbian jessie/non-free Sources [113 kB]
Get:10 http://archive.raspbian.org/raspbian jessie/main Sources [7754 kB]
Ign:11 https://apt.dockerproject.org/repo raspbian-jessie InRelease
Get:12 http://mirrordirector.raspbian.org/raspbian jessie/contrib armhf Packages [43.3 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian jessie/non-free armhf Packages [84.2 kB]
Get:14 http://mirrordirector.raspbian.org/raspbian jessie/rpi armhf Packages [1356 B]
Err:15 https://apt.dockerproject.org/repo raspbian-jessie Release
gnutls_handshake() failed: The TLS connection was non-properly terminated.
Get:16 http://archive.raspbian.org/raspbian jessie/contrib Sources [64.5 kB]
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://raspberrypi.collabora.com wheezy InRelease: The following signatures were invalid: FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5
E: The repository 'https://apt.dockerproject.org/repo raspbian-jessie Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
My sources.list file
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi

I had the same issue and below solution worked for me.
Create a file called badproxy with below lines:
Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;
Acquire::BrokenProxy true;
then copy the file into the apt config folder:
cp ./badproxy /etc/apt/apt.conf.d/99fixbadproxy
I tried above suggestion from docker form

sudo apt remove gnupg
sudo apt install --reinstall gnupg2 (possibly not necessary, but doesn't hurt)
sudo apt install dirmngr
Then run
gpg --keyserver keys.gnupg.net --recv-key FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5
gpg -a --export FF9FD9E73808E2376CB76F0AED4BF9140C50B1C5 | sudo apt-key add -

Related

Raspberry Pi Upgrade Fails

When i tried to upgrade or update raspberry pi or python on raspberry pi, i got this error
pi#raspberry:/$ sudo apt-get install python
sudo: unable to resolve host raspberry: Name or service not known
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
***
Suggested packages:
***
0 upgraded, 101 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,560 kB/33.3 MB of archives.
After this operation, 104 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython2.7-minimal armhf 2.7.16-2+deb10u1 [395 kB]
Get:2 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2.7-minimal armhf 2.7.16-2+deb10u1 [1,091 kB]
Get:3 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2-minimal armhf 2.7.16-1 [41.4 kB]
Get:4 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python-minimal armhf 2.7.16-1 [21.0 kB]
Get:5 http://mirror.as43289.net/raspbian/raspbian buster/main armhf mime-support all 3.62 [37.2 kB]
Get:6 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libexpat1 armhf 2.2.6-2+deb10u1 [77.3 kB]
Get:7 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython2.7-stdlib armhf 2.7.16-2+deb10u1 [1,844 kB]
Get:8 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2.7 armhf 2.7.16-2+deb10u1 [305 kB]
Get:9 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython2-stdlib armhf 2.7.16-1 [20.8 kB]
Get:10 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpython-stdlib armhf 2.7.16-1 [20.8 kB]
Get:11 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python2 armhf 2.7.16-1 [41.6 kB]
Get:12 http://mirror.as43289.net/raspbian/raspbian buster/main armhf python armhf 2.7.16-1 [22.8 kB]
Get:13 http://mirror.as43289.net/raspbian/raspbian buster/main armhf bzip2 armhf 1.0.6-9.2~deb10u1 [46.2 kB]
Get:14 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libmagic-mgc armhf 1:5.35-4+deb10u1 [242 kB]
Get:15 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libmagic1 armhf 1:5.35-4+deb10u1 [110 kB]
Get:16 http://mirror.as43289.net/raspbian/raspbian buster/main armhf file armhf 1:5.35-4+deb10u1 [65.4 kB]
Get:17 http://mirror.as43289.net/raspbian/raspbian buster/main armhf xz-utils armhf 5.2.4-1 [179 kB]
Fetched 4,560 kB in 21s (219 kB/s)
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 29%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 59%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 89%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 100%
dpkg: error: parsing file '/var/lib/dpkg/status' near line 0:
newline in field name '▒PNG'
E: Sub-process /usr/bin/dpkg returned an error code (2)
i used this codes in the beginning. but for each one i got same error that error code (2)
sudo apt-get upgrade
sudo apt-get update
sudo apt-get install python
i'm using Raspberry pi 1 version. it's old version i know but i have to use this.
Please help me guys. Thank all of you.
sudo apt-get update
sudo apt-get upgrade -y
It will fail when upgrading. Because this command is updating sources.list again. Because of this, it shows this error. You can run sudo apt-get update && sudo apt-get upgrade -y again. It's ok.
It seems like you don't have the host properly set on the /etc/hosts file. In order to fix it, you should add raspberry to this same file. You can do so by making sudo nano /etc/hosts and adding this username next to the one you already have after the 127.0.1.1 address. Not after the word localhost (most surely you will have to edit the second line).

MongoDB 4.0 GPG - Invalid Signatures

I am installing MongoDB 4.0.x on an Ubuntu 16.04 (Xenial), using the instruction provided at https://docs.mongodb.com/v4.0/tutorial/install-mongodb-on-ubuntu/.
The command order is (executed inside ubuntu:xenial-20190222 docker container):
echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
apt-key list
/etc/apt/trusted.gpg
--------------------
pub 1024D/437D05B5 2004-09-12
uid Ubuntu Archive Automatic Signing Key <ftpmaster#ubuntu.com>
sub 2048g/79164387 2004-09-12
pub 4096R/C0B21F32 2012-05-11
uid Ubuntu Archive Automatic Signing Key (2012) <ftpmaster#ubuntu.com>
pub 4096R/EFE21092 2012-05-11
uid Ubuntu CD Image Automatic Signing Key (2012) <cdimage#ubuntu.com>
pub 1024D/FBB75451 2004-12-30
uid Ubuntu CD Image Automatic Signing Key <cdimage#ubuntu.com>
pub 4096R/E52529D4 2018-04-18 [expires: 2023-04-17]
uid MongoDB 4.0 Release Signing Key <packaging#mongodb.com>
apt-get update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Ign:3 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease
Get:4 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release [3457 B]
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release.gpg [801 B]
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release.gpg
Ign:6 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease
Get:7 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release [3457 B]
Get:8 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release.gpg [801 B]
Get:9 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse amd64 Packages [12.5 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [1073 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Ign:8 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release.gpg
Get:12 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:13 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse amd64 Packages [12.5 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:15 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse arm64 Packages [12.5 kB]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.7 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [621 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [6282 B]
Get:21 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1443 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.1 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1023 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [19.3 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7942 B]
Get:27 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8807 B]
Fetched 16.4 MB in 4s (3666 kB/s)
Reading package lists... Error!
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release: The following signatures were invalid: BADSIG 68818C72E52529D4 MongoDB 4.0 Release Signing Key <packaging#mongodb.com>
W: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release: The following signatures were invalid: BADSIG 68818C72E52529D4 MongoDB 4.0 Release Signing Key <packaging#mongodb.com>
W: The repository 'https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to stat /var/lib/apt/lists/partial/repo.mongodb.org_apt_ubuntu_dists_xenial_mongodb-org_4.0_Release - pkgAcqTransactionItem::TransactionState-stat (2: No such file or directory)
E: Failed to stat /var/lib/apt/lists/partial/repo.mongodb.org_apt_ubuntu_dists_xenial_mongodb-org_4.0_multiverse_binary-amd64_Packages.lz4 - pkgAcqTransactionItem::TransactionState-stat (2: No such file or directory)
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/repo.mongodb.org_apt_ubuntu_dists_xenial_mongodb-org_4.0_multiverse_binary-arm64_Packages.lz4
E: The package lists or status file could not be parsed or opened.
My Docker file:
FROM ubuntu:xenial-20200212
RUN set -x \
&& DEBIAN_FRONTEND=noninteractive \
&& rm /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 \
&& apt-get update
I tried various solutions from MongoDB GPG - Invalid Signatures, but without success.
The mentioned flow worked before a couple of weeks, and now it fails, any idea on how to resolve?
Retrying today solved the issue for me.
Here is the respective MongoDB issue, which has been fixed in the meanwhile.

Kubernetes' Kubeadm stops at apiclient

I have created a new Ubuntu 16.04 droplet on DigitalOcean and followed those guides respectively to install kubeadm (and its dependencies):
https://docs.docker.com/engine/installation/
https://kubernetes.io/docs/tasks/tools/install-kubectl/
https://kubernetes.io/docs/setup/independent/install-kubeadm/
However, when I run kubeadm init, I get:
root#ubuntu-512mb-nyc3-01:~# kubeadm init
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[preflight] WARNING: docker version is greater than the most recently validated version. Docker version: 17.06.0-ce. Max validated version: 1.12
[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [ubuntu-512mb-nyc3-01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 165.227.70.168]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
I even tried to create a new CentOS 7 droplet to apply the different instructions for CentOS, and I got the same problem.
Here's the full history for what I applied since I created the VPS:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
root#ubuntu-512mb-nyc3-01:~# apt update
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial InRelease
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates InRelease [102 kB]
Get:4 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main Sources [868 kB]
Get:6 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/restricted Sources [4,808 B]
Get:7 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/universe Sources [7,728 kB]
Get:8 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/multiverse Sources [179 kB]
Get:9 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main Sources [265 kB]
Get:10 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/restricted Sources [3,012 B]
Get:11 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe Sources [166 kB]
Get:12 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/multiverse Sources [7,232 B]
Get:13 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 Packages [593 kB]
Get:14 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/main Translation-en [240 kB]
Get:15 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe amd64 Packages [511 kB]
Get:16 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates/universe Translation-en [199 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/main Sources [86.5 kB]
Get:18 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/main Sources [3,312 B]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/restricted Sources [2,604 B]
Get:21 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [38.2 kB]
Get:20 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe Sources [4,400 B]
Get:22 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports/universe amd64 Packages [5,804 B]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/multiverse Sources [1,144 B]
Get:24 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [341 kB]
Get:25 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [144 kB]
Get:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [155 kB]
Get:27 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [79.4 kB]
Get:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2,752 B]
Fetched 11.9 MB in 3s (3,327 kB/s)
ade
Reading package lists... Done
Building dependency tree
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
root#ubuntu-512mb-nyc3-01:~# apt pgrade
E: Invalid operation pgrade
root#ubuntu-512mb-nyc3-01:~# apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
linux-headers-4.4.0-91 linux-headers-4.4.0-91-generic
linux-image-4.4.0-91-generic
The following packages will be upgraded:
git git-man linux-headers-generic linux-headers-virtual
linux-image-virtual linux-virtual
6 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.5 MB of archives.
After this operation, 145 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git-man all 1:2.7.4-0ubuntu1.2 [736 kB]
Get:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.2 [3,163 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-4.4.0-91 all 4.4.0-91.114 [9,876 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-4.4.0-91-generic amd64 4.4.0-91.114 [791 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-image-4.4.0-91-generic amd64 4.4.0-91.114 [21.9 MB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-virtual amd64 4.4.0.91.96 [1,780 B]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-image-virtual amd64 4.4.0.91.96 [2,270 B]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-virtual amd64 4.4.0.91.96 [1,760 B]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-headers-generic amd64 4.4.0.91.96 [2,262 B]
Fetched 36.5 MB in 0s (40.0 MB/s)
(Reading database ... 54209 files and directories currently installed.)
Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1.2_all.deb ...
Unpacking git-man (1:2.7.4-0ubuntu1.2) over (1:2.7.4-0ubuntu1.1) ...
Preparing to unpack .../git_1%3a2.7.4-0ubuntu1.2_amd64.deb ...
Unpacking git (1:2.7.4-0ubuntu1.2) over (1:2.7.4-0ubuntu1.1) ...
Selecting previously unselected package linux-headers-4.4.0-91.
Preparing to unpack .../linux-headers-4.4.0-91_4.4.0-91.114_all.deb ...
Unpacking linux-headers-4.4.0-91 (4.4.0-91.114) ...
Selecting previously unselected package linux-headers-4.4.0-91-generic.
Preparing to unpack .../linux-headers-4.4.0-91-generic_4.4.0-91.114_amd64.deb ...
Unpacking linux-headers-4.4.0-91-generic (4.4.0-91.114) ...
Selecting previously unselected package linux-image-4.4.0-91-generic.
Preparing to unpack .../linux-image-4.4.0-91-generic_4.4.0-91.114_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-91-generic (4.4.0-91.114) ...
Preparing to unpack .../linux-virtual_4.4.0.91.96_amd64.deb ...
Unpacking linux-virtual (4.4.0.91.96) over (4.4.0.87.93) ...
Preparing to unpack .../linux-image-virtual_4.4.0.91.96_amd64.deb ...
Unpacking linux-image-virtual (4.4.0.91.96) over (4.4.0.87.93) ...
Preparing to unpack .../linux-headers-virtual_4.4.0.91.96_amd64.deb ...
Unpacking linux-headers-virtual (4.4.0.91.96) over (4.4.0.87.93) ...
Preparing to unpack .../linux-headers-generic_4.4.0.91.96_amd64.deb ...
Unpacking linux-headers-generic (4.4.0.91.96) over (4.4.0.87.93) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up git-man (1:2.7.4-0ubuntu1.2) ...
Setting up git (1:2.7.4-0ubuntu1.2) ...
Setting up linux-headers-4.4.0-91 (4.4.0-91.114) ...
Setting up linux-headers-4.4.0-91-generic (4.4.0-91.114) ...
Setting up linux-image-4.4.0-91-generic (4.4.0-91.114) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-91-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-91-generic /boot/vmlinuz-4.4.0-91-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-91-generic
Found initrd image: /boot/initrd.img-4.4.0-91-generic
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
done
Setting up linux-image-virtual (4.4.0.91.96) ...
Setting up linux-headers-generic (4.4.0.91.96) ...
Setting up linux-headers-virtual (4.4.0.91.96) ...
Setting up linux-virtual (4.4.0.91.96) ...
root#ubuntu-512mb-nyc3-01:~# sudo apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20160104ubuntu1).
apt-transport-https is already the newest version (1.2.24).
curl is already the newest version (7.47.0-1ubuntu2.2).
software-properties-common is already the newest version (0.96.20.7).
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#ubuntu-512mb-nyc3-01:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
root#ubuntu-512mb-nyc3-01:~# sudo add-apt-repository \
> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> stable"
root#ubuntu-512mb-nyc3-01:~# apt update
Hit:1 http://mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:5 https://download.docker.com/linux/ubuntu xenial InRelease [38.9 kB]
Get:6 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages [1,966 B]
Fetched 40.9 kB in 0s (56.7 kB/s)
sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
root#ubuntu-512mb-nyc3-01:~# sudo apt-get install docker-ce
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
aufs-tools cgroupfs-mount libltdl7
Suggested packages:
mountall
The following NEW packages will be installed:
aufs-tools cgroupfs-mount docker-ce libltdl7
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.6 MB of archives.
After this operation, 96.6 MB of additional disk space will be used.
Get:2 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 17.06.0~ce-0~ubuntu [20.5 MB]
Get:1 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/universe amd64 aufs-tools amd64 1:3.2+20130722-1.1ubuntu1 [92.9 kB]
Get:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/universe amd64 cgroupfs-mount all 1.2 [4,970 B]
Get:4 http://nyc2.mirrors.digitalocean.com/ubuntu xenial/main amd64 libltdl7 amd64 2.4.6-0.1 [38.3 kB]
Fetched 20.6 MB in 0s (23.2 MB/s)
Selecting previously unselected package aufs-tools.
(Reading database ... 82102 files and directories currently installed.)
Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1ubuntu1_amd64.deb ...
Unpacking aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack .../cgroupfs-mount_1.2_all.deb ...
Unpacking cgroupfs-mount (1.2) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../libltdl7_2.4.6-0.1_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-0.1) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_17.06.0~ce-0~ubuntu_amd64.deb ...
Unpacking docker-ce (17.06.0~ce-0~ubuntu) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu19) ...
Setting up aufs-tools (1:3.2+20130722-1.1ubuntu1) ...
Setting up cgroupfs-mount (1.2) ...
Setting up libltdl7:amd64 (2.4.6-0.1) ...
Setting up docker-ce (17.06.0~ce-0~ubuntu) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
root#ubuntu-512mb-nyc3-01:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
root#ubuntu-512mb-nyc3-01:~# curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 1 68.9M 1 995k 0 0 2613k 0 0:00:27 --:--:-- 0:00:27 100 68.9M 100 68.9M 0 0 72.8M 0 --:--:-- --:--:-- --:--:-- 72.8M
root#ubuntu-512mb-nyc3-01:~# chmod +x ./kubectl
root#ubuntu-512mb-nyc3-01:~# sudo mv ./kubectl /usr/local/bin/kubectl
root#ubuntu-512mb-nyc3-01:~# kubectl cluster-info
Kubernetes master is running at http://localhost:8080
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
root#ubuntu-512mb-nyc3-01:~#
root#ubuntu-512mb-nyc3-01:~# apt-get update && apt-get install -y apt-transport-https
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://nyc2.mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:3 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:4 https://download.docker.com/linux/ubuntu xenial InRelease
Hit:5 http://nyc2.mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.2.24).
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#ubuntu-512mb-nyc3-01:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
OK
root#ubuntu-512mb-nyc3-01:~# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
> deb http://apt.kubernetes.io/ kubernetes-xenial main
> EOF
root#ubuntu-512mb-nyc3-01:~# apt-get update
Hit:1 http://mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:3 http://mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:6 https://download.docker.com/linux/ubuntu xenial InRelease
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease [8,942 B]
Get:7 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 Packages [4,977 B]
Fetched 13.9 kB in 0s (16.0 kB/s)
Reading package lists... Done
root#ubuntu-512mb-nyc3-01:~# apt-get install -y kubelet kubeadm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
ebtables kubectl kubernetes-cni socat
The following NEW packages will be installed:
ebtables kubeadm kubectl kubelet kubernetes-cni socat
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 45.4 MB of archives.
After this operation, 334 MB of additional disk space will be used.
Get:1 http://mirrors.digitalocean.com/ubuntu xenial-updates/main amd64 ebtables amd64 2.0.10.4-3.4ubuntu2 [79.4 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu xenial/universe amd64 socat amd64 1.7.3.1-1 [321 kB]
Get:3 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubernetes-cni amd64 0.5.1-00 [5,560 kB]
Get:4 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubelet amd64 1.7.3-01 [19.6 MB]
Get:5 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubectl amd64 1.7.3-01 [10.1 MB]
Get:6 https://packages.cloud.google.com/apt kubernetes-xenial/main amd64 kubeadm amd64 1.7.3-01 [9,796 kB]
Fetched 45.4 MB in 4s (10.2 MB/s)
Selecting previously unselected package ebtables.
(Reading database ... 82383 files and directories currently installed.)
Preparing to unpack .../ebtables_2.0.10.4-3.4ubuntu2_amd64.deb ...
Unpacking ebtables (2.0.10.4-3.4ubuntu2) ...
Selecting previously unselected package kubernetes-cni.
Preparing to unpack .../kubernetes-cni_0.5.1-00_amd64.deb ...
Unpacking kubernetes-cni (0.5.1-00) ...
Selecting previously unselected package socat.
Preparing to unpack .../socat_1.7.3.1-1_amd64.deb ...
Unpacking socat (1.7.3.1-1) ...
Selecting previously unselected package kubelet.
Preparing to unpack .../kubelet_1.7.3-01_amd64.deb ...
Unpacking kubelet (1.7.3-01) ...
Selecting previously unselected package kubectl.
Preparing to unpack .../kubectl_1.7.3-01_amd64.deb ...
Unpacking kubectl (1.7.3-01) ...
Selecting previously unselected package kubeadm.
Preparing to unpack .../kubeadm_1.7.3-01_amd64.deb ...
Unpacking kubeadm (1.7.3-01) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ebtables (2.0.10.4-3.4ubuntu2) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Setting up kubernetes-cni (0.5.1-00) ...
Setting up socat (1.7.3.1-1) ...
Setting up kubelet (1.7.3-01) ...
Setting up kubectl (1.7.3-01) ...
Setting up kubeadm (1.7.3-01) ...
Processing triggers for systemd (229-4ubuntu19) ...
Processing triggers for ureadahead (0.100.0-19) ...
root#ubuntu-512mb-nyc3-01:~# kubeadm init
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[preflight] WARNING: docker version is greater than the most recently validated version. Docker version: 17.06.0-ce. Max validated version: 1.12
[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [ubuntu-512mb-nyc3-01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 165.227.70.168]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
^C
Here's the log from journalctl: https://pastebin.com/S6Tkak3P
How long did you wait for it to be ready? Note that it takes a bit in that step. Moreover, in the journalctl logs there are errors regarding the cni network not being ready, which is something expected. Could you try again and waiting a bit longer?

installing mongodb in a docker container

I am trying to create a docker image for mongodb. I am followed the installation instructions from the official mongodb installation to the letter without success. I have tried every single blog and installation instruction out there but without any success. Any help will be greatly appreciated.
My dockerfile contents :
FROM ubuntu:16.04
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu/ xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-3.4.list
RUN apt-get update && apt-get install -y mongodb-org
RUN mkdir -p /data/db
RUN chown -R mongodb:mongodb /data/db
ADD mongodb.conf /etc/mongodb.conf
ADD mongodb.pem /etc/ssl/certs/mongodb.pem
VOLUME ["/data/db"]
EXPOSE 27017
ENTRYPOINT ["/usr/bin/mongod", "--config", "/etc/mongodb.conf"]
I am using the follwing command :
sudo docker image build -t mongodb .
Everytime I am trying to build the image, I get the following:
Sending build context to Docker daemon 7.68kB
Step 1/11 : FROM ubuntu:16.04
---> 14f60031763d
Step 2/11 : RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
---> Using cache
---> 97a851663e60
Step 3/11 : RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu/ xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-3.4.list
---> Using cache
---> 122a2fad0021
Step 4/11 : RUN apt-get update && apt-get install -y mongodb-org
---> Running in 014e7918e156
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Ign:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Get:3 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release [3457 B]
Get:7 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg [801 B]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [42.0 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [394 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.8 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [184 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2931 B]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:14 http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages [5870 B]
Err:14 http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages
Hash Sum mismatch
Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [208 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [756 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.3 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [645 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [17.5 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4930 B]
Get:25 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6237 B]
Fetched 24.2 MB in 7s (3158 kB/s)
Reading package lists...
E: Failed to fetch http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.4/multiverse/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update && apt-get install -y mongodb-org' returned a non-zero code: 100
The line RUN apt-get update && apt-get install -y mongodb-org should be
RUN apt-get update && apt-get install -y mongodb You can also just use the official mongo image and then provide a docker link
I'm hoping you know that you don't have to go to the effort because there is already an official image on Docker Hub.
However, your error message gives a hint to what went wrong:
mongodb-org/3.4/multiverse/binary-amd64/Packages.gz Hash Sum mismatch
You can correct this if you are determined to make your own image.
One place I would start is looking at the Docker best practices for run. You have split some related to the same dependency over multiple lines in your code, which can cause caching to mismatch versions and hashes. This is likely the problem.
If you aren't satisfied with using the official image directly you can at least look at how it was built here:
https://github.com/docker-library/mongo/blob/c02ca4cce8c69e5069b75cb574d1b99d7b4edaeb/3.4/Dockerfile
I found a solution. Since I changed the network adapter of the VM from NAT to Bridge, the image is building successfully.
I do not understand why the network type would cause this issue, but it it working now.

Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution) show error in ubuntu 16.04

I am used ubuntu 16.04 and try to install atom editor using following commands:-
sudo add-apt-repository ppa:webupd8team/atom
sudo apt-get update; sudo apt-get install atom
But can't istall show error :-
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 https://deb.nodesource.com/node_7.x xenial InRelease
Hit:3 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:7 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:8 http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial InRelease
Hit:9 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:10 http://ppa.launchpad.net/webupd8team/atom/ubuntu xenial InRelease
Hit:11 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
atom : Depends: git
google-chrome-stable : Depends: libappindicator1 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Please tell us how to solov this problem?
Did you try to run the proposed solution ?
apt-get -f install
If this doesn't work, here is a list of other possible solutions to this issue.