Skip to content

Instantly share code, notes, and snippets.

@afahitech
Created April 7, 2020 15:49
Show Gist options
  • Select an option

  • Save afahitech/69ac6a06edcf7113bab4b73c1225db8b to your computer and use it in GitHub Desktop.

Select an option

Save afahitech/69ac6a06edcf7113bab4b73c1225db8b to your computer and use it in GitHub Desktop.
Using docker on Ubuntu
#!/bin/sh
#Running a Docker Container
docker run -it ubuntu
apt update
apt install nginx
node -v
exit
#Managing Docker Containers
docker ps
docker ps -a
docker ps -l
docker start bb6e63edc932
docker stop NAME of file (ubuntu)
docker rm NAME of file (ubuntu)
#Committing Changes in a Container to a Docker Image
docker commit -m "What you did to the image" -a "Author Name" container_id repository/new_image_name
docker commit -m "added nginx" -a "ataur" bb6e63edc932 ataur/ubuntu-nginx
docker images
#Pushing Docker Images to a Docker Repository
docker login -u docker-registry-username
docker login -u afahitech
#Note: If your Docker registry username is different from the local username you used to create the image, you will have to tag your image with your registry username. For the example given in the last step, you would type:
sudo docker tag ataur/ubuntu-nginx afahitech/ubuntu-nginx
#Then you may push your own image using:
docker push docker-registry-username/docker-image-name
#To push the ubuntu-nodejs image to the sammy repository, the command would be:
docker push afahitech/ubuntu-nginx
# Youtube https://youtu.be/cZdHEDs_Uv4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment