docker / docker/docker-install

how to export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock using shell script automatically.

Open
#147 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
3.2k
Forks
863
Avg merge
3h 15m
Merged PRs (30d)
2

Description

Hi,

I would like to automate these steps to install docker as the rootless user for that I've created shell script.but while doing echo "export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock" using shell script it is not working.on manual, it is working fine.

export USERID=$( id |grep uid | awk -F '[ ]' '{print $1}' | awk -F '[(]' '{print $1}'| awk -F '[=]' '{print $2}')
    sudo apt-get install -y uidmap
    curl -fsSL https://get.docker.com/rootless | sh
    echo "DOCKER_HOST=unix:///run/user/${USERID}/docker.sock">>~/.bashrc
    systemctl --user status docker
    systemctl --user start docker

Even though if I export this value to ~/.bashrc, it is not showing in system environment.
Could you please let me know how I can automatically add this value as env on the ubuntu machine.
Thanks
Rohit Thakur.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the shell script on Ubuntu and compare the environment in the current shell with a newly launched shell after writing ~/.bashrc; done means the rootless Docker client sees the intended DOCKER_HOST automatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, shell
Domain
devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.