Ask Your Question
0

how to install docker as root ?

asked 2017-04-21 06:04:54 -0500

zoubayer gravatar image

updated 2017-04-21 09:33:03 -0500

hi everyone , i would love to install docker in a cloud config file but i cant pass to root ! by the way i have first to set a password for my VM because i cant access my ubuntu vm if i dont here is my code

#cloud-config
password: mypassword
chpasswd: { expire: False }
ssh_pwauth: True
runcmd:
  - sudo -s
    apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
    echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
    apt-get update
    apt-get install -y docker-engine
    usermod -aG docker ubuntu
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-04-21 09:32:19 -0500

Hi,

You can use this script to install Docker and change the password

#cloud-config
password: mypassword
chpasswd: { expire: False }
ssh_pwauth: True
package_upgrade: true
package_reboot_if_required: true
runcmd:
- apt-get update
- curl -fsSL https://get.docker.com/ | sh
- curl -fsSL https://get.docker.com/gpg | sudo apt-key add -

Regards

edit flag offensive delete link more

Comments

thanks a lot . and what if i want to add a shell scipt inside ! do i have to put shell: /bin/bash and then past my code ? ( so sorry this my first time using cloud config )

zoubayer gravatar imagezoubayer ( 2017-04-21 10:16:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-04-21 06:04:54 -0500

Seen: 25 times

Last updated: 2 days ago