Creating your first docker container
Before going further, make sure you have properly installed “docker” on your machine, then we can proceed with create docker container.
After installation, now it is time to create the very first container in order to see the power of docker, moreover to remove the confusion of docker’s new commands and older commands, we are going to see the both.
Create docker container using “docker container run” – new command
sudo docker container run –
sudo = for attaining the root level permissions while executing the command.
docker = calling the docker’s cli
container = specifying the context, that we are going to create a container.
run = specifying that we wan to run something in context.
-i = defines that run the container in “interactive mode“
-t = allocate “pseudo tty“
–name = we can give any name to our container, bu for now we have ginve “c1”
alpine = it is the name of the image from which we want to create a container.
ash = it states that after running the container, drop us into “ash = ashell” which is native to the alpine image.
Now, after creating the container, we need to crosscheck whether our container is running or not and in order to do that, follow the picture below.
So, to list the running containers with new command:
sudo docker container ls
Create a docker container using “docker run” – old command
docker run –
Now, to list the running containers with old command:
sudo docker ps
To learn more about docker, follow -> Learn Docker