The aim of the Docker-1 project is to make you handle docker and docker-machine, the bases to understand the idea of containerization of services. You can see this project as an initiation.
In this first part you will be introduced to Docker and its main options
Docker makes it possible to create yourself OWN containers for your OWN applications! Dockerfiles use a specific syntax that reuses a base image or an existing container to add your own dependencies and your own files.
Now we can create our future work environments, such as:
- Python
- Golang
- C
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install docker
brew install docker-machine
brew cask install virtualbox
-
List available machines docker-machine ls
-
Create a new virtual machine docker-machine create --driver virtualbox default
-
Run the following command to tell the Docker ‘which machine’ to execute docker command to: docker-machine env default
-
Connect your shell to the new machine eval $(docker-machine env default)
Source: https://tinyurl.com/yjzesbc7
Refer step 4 onwards : https://tinyurl.com/y24z2357
- Open a docker terminal
- Get the image running as a container in the background: docker run -d -it <image_id>
Tip: docker ps will show the container_id that you just fired up from said image.
- docker exec -it <container_id> bash Now your docker terminal is showing an interactive terminal to the container.
- Open up another docker terminal and perform step 3 to create another interactive terminal to the container. (Rinse and Repeat)
apt-get update && apt-get install vim -y
docker commit -m "What you did to the image" -a "Author Name" container_id repository/new_image_name
Example: docker commit -m "installed vim" -a "MGRM" 16ff6774e0c9 mariagore/ubuntu-vim