Ubuntu 14.04 Docker Install

2/12/2022by admin

Answer (1 of 2): Docker is more of an OS abstraction than an application virtualization or streamer. You could run a copy of Windows in a Docker container and have Office 2013 inside of it. Install Docker Machine on Ubuntu 14.04. Create machine (this command will download a lightweight Linux distribution boot2docker with the Docker daemon installed and will create and start a VirtualBox VM with Docker running) curl nginx in a container. Sign up for free to join this conversation on GitHub.

Update – February 11, 2017 – Added Cleaning up docker section.

Pre-reqs:

Docker install ubuntu
  • OS: Ubuntu 14.04
  • sudo access to root
  • internet access

Install Docker

Update package manager, install the docker.io package & create a symlink from docker.io to docker, fix bash auto complete to add ‘docker’

Start Docker on system start-up

14.04

Download a Docker container

Run Docker container

Setup a basic ubuntu container with a bash shell, we just run one command. docker run will run a command in a new container, -i attaches stdin and stdout, -t allocates a tty, -h allocates a hostname, and we’re using the standard ubuntu container.

That’s it! You’re now using a bash shell inside of a ubuntu docker container.

To disconnect, or detach, from the shell/container without exiting/shutting down use the escape sequence Ctrl-p + Ctrl-q.

Docker Install Ubuntu

To shutdown the container, run exit, but remember that container storage is ephemeral, meaning data isn’t saved. You’ll need to use docker volumes.

Ubuntu 14.04 Docker Install

To search for other community docker containers

List containers

docker ps will list running container, -a list all containers, -l list latest created containers including non-running containers, a –filter “status=running” list all running containers

Attach to a container

Committing changes to your container

To create a new image from changes to a container, it’s a simple as running just one command, docker commit.

View container logs

14.04

To view the logs for a container it’s as simple as running just one command, docker logs. If you don’t have any logs listed then no changes have been made to the container.

Restart a running container

To restart a running container, it’s a simple as running just one command, docker restart.

Stop a running container (or multiple containers)

To stop a running container, it’s a simple as running just one command, docker stop.

List all images/containers on this server

To view docker usage stats – CPU, MEM & Network

Docker-compose Install

Keeping persistent data – docker storage volumes

There’s no way to directly create a “data volume” in Docker, so instead we create a data volume container with a volume attached to it. For any other containers that you then want to connect to this data volume container, use the Docker’s --volumes-from option to grab the volume from this container and apply them to the current container.

This created a container named datacontainer based off of the ubuntu image and in the directory /data1.

Now, if we run a new Ubuntu container with the --volumes-from flag anything we write to the /data1 directory will get saved

The file ‘thisisapersistentfile.txt’ we created will now be persistent on a container named datacontainer and in the directory/data1.

Cleaning up docker

Docker Compose Install Ubuntu 14.04

After starting and stop all of those containers, stuuff get left behind (so you might inspect it later if you desire). But, if you are running out of disk space because of docker, give this script a try.

Ubuntu 14.04 Docker Install For Mac

Docker help

sudo docker –help

Comments are closed.