Installing Docker and Ubuntu Image shell

The steps below shows how to install docker on x86_64 bit ubuntu desktop and have independent ubuntu shell inside docker.

[ Note: docker works only with 64 bit ubuntu, hence if you have 32 bit ubuntu machine, it will not work ]

If you have any nonworking traces of cocker, remove it using below command,

sudo apt-get remove docker docker-engine

Type below commands on your ubuntu terminal,

sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce

The Docker daemon starts automatically. You can verify it as,

ps -ax | grep docker

24946 ? Ssl 0:11 /usr/bin/dockerd –raw-logs
24958 ? Ssl 0:01 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock –metrics-interval=0 –start-timeout 2m –state-dir /var/run/docker/libcontainerd/containerd –shim docker-containerd-shim –runtime docker-runc

Verify that Docker is installed correctly by running the hello-world image.

sudo docker run hello-world

Now to install new ubuntu image, and going to shell, type below command,

sudo docker run -it ubuntu bash

This will take you to new shell, where you can work as needed, and exit using below command,

 root@4feb8fa6f496:/# exit 

You can check which images has been installed as,

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              6a2f32de169d        35 hours ago        117 MB
hello-world         latest              48b5124b2768        3 months ago        1.84 kB
$ sudo docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
3b4ceb96c87b        ubuntu              "/bin/bash"         About a minute ago   Exited (0) About a minute ago                       peaceful_euler

Start docker container,

sudo docker container start 3b4ceb96c87b
3b4ceb96c87b
 

This will start docker with basic ubuntu.

Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded
Tags:

Leave a Reply