dockerhub short guide - ovis-hpc/ovis-wiki GitHub Wiki
This is a short guide on how to update ovishpc images on dockerhub.
- Web Login
- Access Token and CLI Login
- Pull an Image
- Create and Run a Container
- Modify the Container
- Commit the Change
- Push to dockerhub
- Remove the Container
Web Login
Go to https://hub.docker.com and login with username ovishpc. Ask Narate for the password, or simply "forgot password" and check [email protected] e-mail.
Access Token and CLI Login
- After logged in on the web, go to https://hub.docker.com/settings/security and click "New Access Token".
- Then, name an access token for others to know the purpose of the access token. It may just be your name so that our team knows who created and used the token.
- Click "Create", and don't close the dialog that has the token yet.
- On CLI,
$ docker login --username ovishpc
- Then, paste the token when you're asked for it.
Pull an Image
root@baremetal$ docker pull ovishpc/ldmscon2020-single
# Change ldmscon2020-single to any image you want
Create and Run a Container
docker run -it --hostname mycont --name mycont ovishpc/ldmscon2020-single bash
Note:
-ioption means interactive,-toption means tty, so thatbashin the container connects to your tty.--hostname mycontso that you seemycontis the container's hostname. If this is not set, a randomly generated hostname will be used an may be confusing when seeing it on the bash prompt.--name mycontto name the containermycontto make it easy to refer to on the docker host. If this is not given, also another randomly generated name (which is also different from the hostname) will be used and could be confusing.
Modify the Container
You may modify the content in the container from bash within the container, or if you need to copy files from docker host (your bare metal machine) you can use:
root@baremetal$ docker cp FILE_OR_DIR_PATH mycont:DEST_DIR
# Please note that docker cp is recursive, and it will create a new directory in DEST_DIR.
# For example,
# docker cp /home/user mycont:/home/user
# will create /home/user/user directory wile
# docker cp /home/user mycont:/home
# is what we really want
Commit the Change
After container modification is done, you can commit its contents to the image on the host CLI as follows:
root@baremetal$ docker commit mycont ovishpc/ldmscon2020-single
Push to dockerhub
root@baremetal$ docker push ovishpc/ldmscon2020-single
Remove the Container
When bash exited, your container will be in stop state, but has not yet been removed. To remove the container:
root@baremetal$ docker rm mycont