0

I first install docker through following command from docker site:

curl -s -O https://get.docker.com/builds/Linux/x86_64/docker-1.6.1 && chmod +x docker-1.6.1 && sudo mv docker-1.6.1 /usr/local/bin/docker

Then I remove the docker in /usr/local/bin directory.

I install docker through yum again, this time docker is installed in /usr/bin directory:

[root@dl380gen8snbjbb ~]# ls -lt /usr/bin/docker
-rwxr-xr-x 1 root root 13451927 Apr 20 13:44 /usr/bin/docker

When I execute docker in command:

[root@dl380gen8snbjbb ~]# docker
-bash: /usr/local/bin/docker: No such file or directory

but the /usr/bin is actually in PATH:

[root@dl380gen8snbjbb ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

Why does the system doesn't seek docker command in /usr/bin directory?

Nan Xiao
  • 16,671
  • 18
  • 103
  • 164

1 Answers1

2

Check following link: https://unix.stackexchange.com/q/5609/55635

bash does cache the full path to a command. You can verify that the command you are trying to execute is hashed with the type command:

$ type svnsync svnsync is hashed (/usr/local/bin/svnsync)

To clear the entire cache:

$ hash -r

Or just one entry:

$ hash -d svnsync

For additional information, consult help hash and man bash.

Community
  • 1
  • 1
Samuel
  • 3,631
  • 5
  • 37
  • 71